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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Redraidas1
Helper I
Helper I

Count NON-blank measures

 

Is there any way to count how many NON-Blank measures are in your variable? I want to use COUNTA but PowerBI won't let me. Is there any way to make it work? For example, if Calc1 returns 10, Calc 2 returns 15 and Calc 3 is blank, than I want my measure to return count 2. 

 

Measure 1 =

VAR Calculations =
[Calc1] + [Calc2] + [Calc3] 

RETURN
COUNTA(Calculations)  -- this bit gets squiggled in red
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Rather than using COUNTA, you could use an IF statement 

 

Measure 1 =

VAR _1 = IF([Calc1]>0, 1,0)
VAR _2 = IF([Calc2]>0, 1,0)
VAR _3 = IF([Calc3]>0, 1,0)

Return 
_1 + _2 + _3

Essentially if Calc1 is more than 0 then give it a value of 1, same with calc2 and 3 then add them all up at the end.

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Rather than using COUNTA, you could use an IF statement 

 

Measure 1 =

VAR _1 = IF([Calc1]>0, 1,0)
VAR _2 = IF([Calc2]>0, 1,0)
VAR _3 = IF([Calc3]>0, 1,0)

Return 
_1 + _2 + _3

Essentially if Calc1 is more than 0 then give it a value of 1, same with calc2 and 3 then add them all up at the end.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.