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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

What is wrong with this DAX?

Hi All,

I need to calculate what is the total no. of rows where PI is NOT Blank from the Planning table.

So I wrote the DAX

PI Count = IF(ISBLANK(MAX(Planning[PI])),Blank(),COUNT(Pl])).
 
But it is giving me total no of rows in that table. It means my "IF" clause is not working.
Just wanted to know what is wrong with this DAX?
In place of MAX what other aggregate function() I can use?
 
TIA
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Anonymous - Try:

PI Count = COUNTROWS(FILTER('Planning',[PI] <> BLANK()))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@Anonymous - Try:

PI Count = COUNTROWS(FILTER('Planning',[PI] <> BLANK()))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler 

Just curious to know what is wrong with that DAX?

 

@Anonymous - 

 

PI Count = IF(ISBLANK(MAX(Planning[PI])),Blank(),COUNT(Pl])).

 

So basically what this says is get the MAX of the column PI and check if it is BLANK. But, this is going across the entire table in context, not row by row (iterator) so it will likely never be blank because you are getting the MAX. Thus, you always get the count of the rows in the table in context. I would suspect that if you used MIN you would end up always getting BLANK since the mininum value in that column is probably BLANK.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler Thanks you so much Greg 👍

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors