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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
BobKoenen
Helper IV
Helper IV

Most efficient way to filter a measure on a related table

HI you all,

 

I want to filter a measure on a variable from my dim. table, because my data table had a lot of records I want to structure it the most efficient way. 

 

My data table looks like this 

EMployeeProjectHours
JoeA1
JoeA4
JoeB2
JoeC2
JoeC4

 

I want to know how many Projects an employee has worked on. I created the measure     NR.ofproject = DISTINCTCOUNT(data,project)   Which works perfectly. 

 

Now I want to filter this measure based on my dimension table 

ProjectProject Type
AFree
BFree
CPaid

 

So I tried to create a measure Nr. of Free projects = CALCULATE(NR. OF PROJECTS, FILTER(RELATED(PROJECTS, PROJECTTYPE = "Free")))  But it does not work.

 

Because my data table consists out of + 1m records I would like to create an as fast as possible measure.  

 

Can you help me?

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@BobKoenen 

maybe you can try this

Measure = CALCULATE(DISTINCTCOUNT('Table'[Project]),FILTER('Table (2)','Table (2)'[Project Type]="Free"))

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
v-xuding-msft
Community Support
Community Support

Hi @BobKoenen ,

 

You can filter directly by using the slicers, because your two tables have a one-to-many relationship.

Or use @ryan_mayu’s suggestion.

 

v-xuding-msft_0-1606361362808.png

 

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ryan_mayu
Super User
Super User

@BobKoenen 

maybe you can try this

Measure = CALCULATE(DISTINCTCOUNT('Table'[Project]),FILTER('Table (2)','Table (2)'[Project Type]="Free"))

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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