FIRSTNONBLANK Function (DAX)

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.

FIRSTNONBLANK Formula Syntax

FIRSTNONBLANK(
     <column>,<expression>
)

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

Ultimate-Beginners-Guide-To-PowerBI
Center of Excellence

DOWNLOAD


Download our comprehensive DAX Formula Reference Guide as perfect companion as you learn how to use DAX formulas within Power BI.


Download DAX Formulas Reference Guide
Download DAX Formula Reference Guide
Membership