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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Kenmare
Frequent Visitor

Measure to count items in the relatedtable

Hi !

 

I have a table called Round in which there are several events stored in a table called Event.

They are linked by the RoundId like this :

Model.png

 

 

 

 

 

The idea of my measure is to count, for each round, how many events are stored.

The relation is active in my model (even tried with USE RELATIONSHIP), I don't know what is wrong in the following measure :

Number of events = CALCULATE (COUNTROWS(RELATEDTABLE(event)))
 
Indeed the result is not good when I try to put it in my report:
Result.png
 
 
 
 
ID is correct but no result is displayed when adding the measure.
Have you got an idea ? I found a lot of answers in other topics but no one worked for me.
Thanks !
2 REPLIES 2
gmsamborn
Super User
Super User

Hi @Kenmare 

A measure to use in a table like that would be:

No of Events = DISTINCTCOUNT( 'Table Events'[EventID] )
 
Your DAX works as a calculated column on your 'Table Round' table since that is on the one side of the one-to-many relationship with 'Table Events'.
(In a measure like your DAX, how would you be specifying which table 'Table Events' is related to?  You can't.)
 


Proud to be a Super User!

daxformatter.com makes life EASIER!

Hi @gmsamborn 

 

Thank you for your reply. I thought having the round id in my chart could help. 

But it doesn't seem to be possible / a good idea.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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