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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

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.


Click here to visit 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.


Click here to visit 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.


Click here to visit 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.


Click here to visit my LinkedIn page

Anonymous
Not applicable

Thank you so much !

Anonymous
Not applicable

You're a hero

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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