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
SgtMeowmers
New Member

Distinct Count dependent on slicer

I am trying to count the number of projects that are meeting a certain goal, there are many projects in which some can belong to multiple cells.  Table is layed out similar to below:

labprojectFundingexpensed
A110050
B120060
B2300200
C3200200

 

I have a measure to calculate the Expensed % (Expensed/Funding).

On my Report, there is a slicer where you can look at how each lab is performing, or if no labs are selected than it will look at overall performance.  I am wanting to count how many projects are meeting the expensed goal (lets say it is 50%)

My formula is 
Meet Goal = calculate( distinctcount(table[project]), filter(table, Expensed % >= to ExpensedGoal)))

The formula works when I have the report filterred to a single lab, but if I am viewing all labs then the count goes wrong.  For example it will count project 1 as meeting goal becuase it meets goall under Lab A, even though project 1 does not meet goal when you combine Lab A and B's performance.

How can I have the count work accurately for when all labs are selected?

1 ACCEPTED SOLUTION

FYI, got it to work by creating a summarized table by the projects.  I then adjusted my meet goal formula with :
if ( hasonevalue(table[lab],  calculate( distinctcount(table[project]), filter(table, table[Expensed %] >= to ExpensedGoal))),  calculate( distinctcount(table[project]), filter(calculatedtable, calculatedtable[Expensed %] >= to ExpensedGoal)))

definately not the best way to go about it, but is my work around until I get something else working.

View solution in original post

3 REPLIES 3
khaledHabib90
Resolver II
Resolver II

the shorter way to answer this is to create a new calculated column (not a measure) in your table to for Expenses %

then your "Meet Goal" measure should work

the problem you are facing is related to row context operations, the way you were doing it is not allowing for the measure Expenses % to calculate row by row

 

If I answered your question please accept the reply as the solution 🙂

It still seems to be counting the same.  I created the collumn and then changed the formula to:
Meet Goal = calculate( distinctcount(table[project]), filter(table, table[Expensed %] >= to ExpensedGoal)))

When I click the slicer for an individual lab it counts correctly, it is only when all are selected that it seems to count a project as long as the goal is met in at least one of the associated labs

FYI, got it to work by creating a summarized table by the projects.  I then adjusted my meet goal formula with :
if ( hasonevalue(table[lab],  calculate( distinctcount(table[project]), filter(table, table[Expensed %] >= to ExpensedGoal))),  calculate( distinctcount(table[project]), filter(calculatedtable, calculatedtable[Expensed %] >= to ExpensedGoal)))

definately not the best way to go about it, but is my work around until I get something else working.

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