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
hamadani
Frequent Visitor

Comparing count values with and without filters

Hi All,

 

I am trying to compare the total count difference of policies per company with AND without the slicer.

 

Here is a simple example of my scenario:

 

Compnay NamePolicy NumberFilter XFilter Y
Company A123TrueFalse
Company A456FalseFalse
Company A789FalseTrue
Company A123FalseFalse
Company A050TrueTrue

 

Therefore, If Slicer X is set to True and slicer Y is set to False, I expect to get 25% for Company A (1 distinct policy which satisfies the filters divided by total of 4 distinct policies for company A). The point here is that the denomitor should be always constant regardless of filter values.

 

I used the below DAX but this will change the denomitor as I apply the filters:
PoliciesPerCompany = CALCULATE(DISTINCTCOUNT(MyTable[PolicyNumber]), GROUPBY(MyTable,MyTable[CompanyName]))
 
Any help would be appreciated.
1 ACCEPTED SOLUTION
ArmandoFranco
Frequent Visitor

Policies by company = DIVIDE( DISTINCTCOUNT(MyTable[PolicyNumber]) , CALCULATE( DISTINCTCOUNT(MyTable[PolicyNumber]), ALL(MyTable[Filter X]), ALL(MyTable[Filter Y])))

The numerator applies the whole filter context, the denominator replaces Filter X and Filter Y with all the values for both.

View solution in original post

1 REPLY 1
ArmandoFranco
Frequent Visitor

Policies by company = DIVIDE( DISTINCTCOUNT(MyTable[PolicyNumber]) , CALCULATE( DISTINCTCOUNT(MyTable[PolicyNumber]), ALL(MyTable[Filter X]), ALL(MyTable[Filter Y])))

The numerator applies the whole filter context, the denominator replaces Filter X and Filter Y with all the values for both.

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.