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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Is it possible to count the result of a measure?

Hi,

 

I was wondering if there was possible to count the result of a measure?

 

I have one fact table that contains:

ID_1 | ID_2

123   123

456   456

789   987

654   321

 

As you can see some of the ID 1 and ID 2 are the same, and some are diffrent.

I then have a measure like this:
measure =
VAR ID1 = SUM ( 'Table'[ID_1] )
VAR ID2 = SUM ( 'Table'[ID_2] )
VAR Result = IF ( ID1 <> ID2; 1; 0 )
RETURN
Result

Now I want to count or sum how many has 1 and how many has 0.

I know I can make a calculated column in DAX and then use COUNTROWS, but I was wondering if its possible to solve this with a measure?

Let me know if you need more information or if something is unclear.

 

Thanks,

Marius

1 ACCEPTED SOLUTION
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Based on my test, you could refer to below measures:

sum equals to 0 = COUNTROWS(FILTER('Table','Table'[measure]=0))
sum equals to 1 = COUNTROWS(FILTER('Table','Table'[measure]=1))

Result:

1.PNG

 

Regards,

Daniel He

 

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Based on my test, you could refer to below measures:

sum equals to 0 = COUNTROWS(FILTER('Table','Table'[measure]=0))
sum equals to 1 = COUNTROWS(FILTER('Table','Table'[measure]=1))

Result:

1.PNG

 

Regards,

Daniel He

 

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Can we create the measure so that can be used on bar chart on Y -axis, basically that will count the rows having the 0 and 1 in one measure and we can create the bar chart ?

Greg_Deckler
Community Champion
Community Champion

Should be able to do something along the lines of:

 

Measure 2 = 
SUMX(SUMMARIZE('Table',[ID_1],"__Measure",[measure]),[__Measure])


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...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors