How does the FIRSTNONBLANK function (DAX) work?

The FIRSTNONBLANK function (DAX) returns the first value in the column, column, filtered by the current context, where the expression is not blank.



How do you use the FIRSTNONBLANK function?

This function is typically used to return the first value of a column for which the expression is not blank. For example, you could get the last value for which there were sales of a product.

Related Blog Posts

Related Support Forum Posts

Direct Query – Apply Functions to Columns
Employee Count- Totals Not Working
Count the number of months since a product has been introduced

Considerations when using the FIRSTNONBLANK function

The column argument can be any of the following:

  • A reference to any column.
  • A table with a single column.
  • A Boolean expression that defines a single-column table .

Related Video Tutorials

Formula examples using the FIRSTNONBLANK function

= FIRSTNONBLANK (Sales [Sales Amount], MIN (Sales [Date])>3/31/2015)

= CALCULATE(FIRSTNONBLANK(FactSales[Order_Date],TRUE()), FILTER(FactSales,YEAR(FactSales[Order_Date])=2014))

= CALCULATE(SUM(FactSales[Net_Sales]), FILTER(FactSales,YEAR(FactSales[Order_Date])=2014), FIRSTNONBLANK(FactSales[Order_Date],TRUE()))

Related DAX Functions

Related Course Modules



To access our comprehensive DAX formula reference guide just insert your email address below. The resource will download immediately and we’ll also email it to you.