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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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

Click here to schedule a short Teams meeting to discuss your question.

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

Click here to schedule a short Teams meeting to discuss your question.

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

Click here to schedule a short Teams meeting to discuss your question.
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

Click here to schedule a short Teams meeting to discuss your question.
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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.