Daily DAX : Day310 FIRSTNONBLANKVALUE

FIRSTNONBLANKVALUE DAX Function

Description

The FIRSTNONBLANKVALUE function in Power BI DAX returns the first non-blank value of a specified column or expression, evaluated in the context of a sorted column.

Syntax

FIRSTNONBLANKVALUE(<column>, <expression>)
  • <column>: The column used to determine the sort order for finding the first non-blank value.
  • <expression>: The expression or column to evaluate for the non-blank value.

Use Case

FIRSTNONBLANKVALUE is useful in scenarios where you need to retrieve the first valid (non-blank) value in a dataset, such as:

  • Finding the first recorded sales amount for a customer in a sorted date order.
  • Retrieving the first non-blank status or category in a time series.
  • Analyzing time-based data where the earliest non-blank entry is needed.

Example

Suppose you have a table Sales with columns Date, Customer, and Amount, and you want the first non-blank sales amount for each customer, sorted by date.

FirstSale = 
FIRSTNONBLANKVALUE(Sales[Date], Sales[Amount])
    

This measure returns the first non-blank Amount for each customer, based on the earliest Date.

Notes

  • The function respects the filter context, so it only considers rows that meet the applied filters.
  • The sort order is determined by the <column> argument, typically a date or numeric column.
  • If all values in the expression are blank, the function returns a blank result.

Comments

Popular posts from this blog

Daily DAX : Day 65 INFO.TABLEPERMISSIONS

Daily DAX : Day 55 PV