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

CALCULATE Function - utilizing a date filter

I am attempting to perform a CALCULATE function that provides me with the overall % breakout by Disposition Value [field] by Month.  I am using the following formula:  

Disposition % = DIVIDE(SUM(Query1[BHMP_SVC_FLG]),CALCULATE(COUNT(Query1[BHMP_SVC_FLG2]),KEEPFILTERS(Query1[Metric_Month])))
 
Where values for BHMP_SVC_FLG & BHMP_SVC_FL2 = "1" or "0" for each record.  Am looking to calculate the Total Disposition % by Disposition type for each month (i.e. Metric Month] of the year for 2022.  There are multiple Disposition Type values: "Community", "CHS Observation", "ED", "OTHER" etc. and should account for 100% of total Dispositions.
 
Actual Dispositon calc for all Disposition Types in Apr 22' should sum to 100% (Denom = 1,301).  However, total % from all Disposition types exceed 100%.  Results from Formula above is:  Community: 72% (633/881); CHS Observation: 53% (210/396);    ED: 60% (3/5);  OTHER: 68% (4/6).   As you can see, the %'s when added together, exceed 100% of total.
 
Please let me know how I can adjust my formula to obtain the overall % distribution by Dispositon Type.
 
Thanks,
 
Sean
 
 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try

Disposition % = DIVIDE(SUM(Query1[BHMP_SVC_FLG]),CALCULATE(COUNT(Query1[BHMP_SVC_FLG2]),filter(all(Query1), Query1[Metric_Month] = max(Query1[Metric_Month]))))

 

or


Disposition % = DIVIDE(SUM(Query1[BHMP_SVC_FLG]),CALCULATE(COUNT(Query1[BHMP_SVC_FLG2]),removefilters( Query1[Disposition]) ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@amitchandak :  Thank you very much for responding to my post!  The top formula provided me with the desired results I was looking for.  I did change the Numerator from "SUM" to "COUNT", but the % of Total for each month was correctly calculated thereafter.  I greatly appreciate your assistance.

amitchandak
Super User
Super User

@Anonymous , Try

Disposition % = DIVIDE(SUM(Query1[BHMP_SVC_FLG]),CALCULATE(COUNT(Query1[BHMP_SVC_FLG2]),filter(all(Query1), Query1[Metric_Month] = max(Query1[Metric_Month]))))

 

or


Disposition % = DIVIDE(SUM(Query1[BHMP_SVC_FLG]),CALCULATE(COUNT(Query1[BHMP_SVC_FLG2]),removefilters( Query1[Disposition]) ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.