Quantcast
Channel: SQLBI
Viewing all articles
Browse latest Browse all 434

Use FIRSTNONBLANK and LASTNONBLANK instead of MIN and MAX #dax

$
0
0

You are probably used to think to FIRSTNONBLANK and LASTNONBLANK as DAX functions related to time-intelligence calculations (usually for semi-additive measures). However, these functions have a syntax and a behavior that can be useful in other scenarios.

For example: you might be aware that MIN and MAX cannot be used with text columns. However, you can use FIRSTNONBLANK and LASTNONBLANK instead of MIN and MAX, respectively. In fact, this is the corresponding syntax:

MIN(<column> )= FIRSTNONBLANK(<column>, 1 )
MAX(<column> )= LASTNONBLANK(<column>, 1 )

In my new article Alternative use of FIRSTNONBLANK and LASTNONBLANK, you can find a broader explanation of FIRSTNONBLANK and LASTNONBLANK behavior, with other scenarios where these functions can be useful.


Viewing all articles
Browse latest Browse all 434

Trending Articles