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
Anonymous
Not applicable

Count occurrences ????

I have a table which contains all possible values eg: 

moustafa67_1-1636975083280.png

And I have another table : 

moustafa67_2-1636975107964.png

 

I need to count how often each value appears like this: 

moustafa67_3-1636975144910.png

But how do I realize this ?!?!

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I am not sure whether I understood your question correctly, but please check the below picture and the attached pbix file.

 

Picture1.png

 

Occurrences: =
VAR currentvalue =
MAX ( 'Values'[Values] )
RETURN
IF (
HASONEVALUE ( 'Values'[Values] ),
CALCULATE ( COUNTROWS ( Data ), FILTER ( Data, Data[Column1] = currentvalue ) )
+ CALCULATE ( COUNTROWS ( Data ), FILTER ( Data, Data[Column2] = currentvalue ) )
+ CALCULATE ( COUNTROWS ( Data ), FILTER ( Data, Data[Column3] = currentvalue ) )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

Hi,

please check the attached pbix file.

 

Picture1.png

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi,

I am not sure whether I understood your question correctly, but please check the below picture and the attached pbix file.

 

Picture1.png

 

Occurrences: =
VAR currentvalue =
MAX ( 'Values'[Values] )
RETURN
IF (
HASONEVALUE ( 'Values'[Values] ),
CALCULATE ( COUNTROWS ( Data ), FILTER ( Data, Data[Column1] = currentvalue ) )
+ CALCULATE ( COUNTROWS ( Data ), FILTER ( Data, Data[Column2] = currentvalue ) )
+ CALCULATE ( COUNTROWS ( Data ), FILTER ( Data, Data[Column3] = currentvalue ) )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

@Jihwan_Kim How can I get the total?

Hi,

please check the attached pbix file.

 

Picture1.png

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

Thank you so much !

Anonymous
Not applicable

You're a hero

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.