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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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]) ))

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]) ))

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Kudoed Authors