Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
AlexGQc
New Member

Is it possible to make a "SECONDNONBLANKVALUE" measure?

Hi,

 

I'm trying to make something that emulates FIRSTNONBLANKVALUE, but i want it to instead return the nTH value (second, third, fourth...).

 

I tried a few things but nothing worked right. Is it something that can be done?

 

(The values are text).

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

Hi, @AlexGQc , sure thing, as well as 3rd, 4th, 5th ... NONBLANKVALUE alike. You might want to try this pattern,

Nth_NONBLANKVALUE =
LASTNONBLANKVALUE (
    TOPN ( n, ... ),
    1
)

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

daxer-almighty
Solution Sage
Solution Sage

Of course, it's possible. With DAX almost anything is possible, bar some recurrent formulae that can't be expressed in a closed form.

 

To do this, however, you have to create it straight in the model, so it'll be specific to it. You can't create something that will be a general function like FIRSTNONBLANKVALUE. There is no way to define general formulae that would work similarly to the native DAX functions.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.