The FIRSTNONBLANK DAX function is used to returns the first value in the column for which the expression has a non blank value. This function comes under Time Intelligence DAX functions category.
|1||Column||The source values.|
|2||Expression||The expression to be evaluated for each value.|
Let’s start with an example step by step-
Step-1: Dataset as mentioned below & our Dataset name is FNBDAX.
Step-2: Create one measure for Sum of Total Sales.
Tot sales = SUM(FNBDAX[Sales])
Step-3: Now create measure to get first non blank date according to Sale.
FNB_Date = FIRSTNONBLANK(FNBDAX[Date],[Tot sales])
Step-4: To see measure output take one card visual from Visualization pane & drag measure to over it.
To get the first non blank value, Power BI DAX engine sort the data in backend then returns the value, to check this – sort table data date wise ascending order. After sort you will see first non blank date is 2018-01-05.
Step-5: According to above Screen shot First Non Blank Month according to Salary is JAN. But practically this is not correct , as I told Power BI sort data according to column.
So if you will sort month column, then you will get FAB is first non Blank month, let’s understand-Measure for first non blank month according to salary-
FNB_Month = FIRSTNONBLANK(FNBDAX[Month],[Tot sales])
Similar DAX: LASTNONBLANK
Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.