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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Eth
New Member

sumx with hierarchy

Sorry if this has been asked already but haven't been able to find anything. 

 

I have a table that looks like this:

RegionBranchItemQty RequestedQty SentDate
Region ABranch 1Pizza1091/1/22
Region ABranch 2Pizza10121/1/22
Region BBranch 3Crotons541/1/22
Region ABranch 1Pizza5101/7/22
Region ABranch 2Pizza1061/7/22
Region ABranch 1Croutons1051/7/22
Region ABranch 1Croutons1071/8/22

 

I'm working on a drill down report to show fulfillment rate across the date range (slicer) at each level - region, branch and item. I have this formula 

Fulfillment Rate = if(SumX(VALUES(Daily[Item]),CALCULATE(Sum(Daily[Qtyt Sent])))/SumX(VALUES(Daily[Item]),CALCULATE(Sum(Daily[Qty Requested])))>.99, 1, SumX(VALUES(Daily[Item]),CALCULATE(Sum(Daily[Qtyt Sent])))/SumX(VALUES(Daily[Item]),CALCULATE(Sum(Daily[Qty Requested]))))

 

Which does a good job of getting the individual item fulfillment rates across the date slicer but the results are wrong at the branch and region level. For instance if Branch 1 is has 100 pizza requests, 150 pizza sends and 100 crouton requests with 60 crouton sends it shows the Branch 1 fulfillment rate as 100% since total qty sent>qty requested. It should show as 80% since the Branch 1 pizza rate is 100% and the crouton rate is 60%. I'd like this logic to roll up to the region level as well. 

 

Let me know if this is doable and if you have any questions.

Thanks for your help! I've been stuck on this for awhile now

-Jon 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

You're grouping items together before dividing. Try calculating the ratio for each item and then averaging.

Fulfillment Rate =
VAR Summary =
    ADDCOLUMNS (
        SUMMARIZE (
            Daily,
            Daily[Item],
            "@Sent", SUM ( Daily[Qty Sent] ),
            "@Requested", SUM ( Daily[Qty Requested] )
        ),
        "@Ratio", MIN ( 1, DIVIDE ( [@Requested], [@Sent] ) )
    )
RETURN
    AVERAGEX ( Summary, [@Ratio] )

 

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

You're grouping items together before dividing. Try calculating the ratio for each item and then averaging.

Fulfillment Rate =
VAR Summary =
    ADDCOLUMNS (
        SUMMARIZE (
            Daily,
            Daily[Item],
            "@Sent", SUM ( Daily[Qty Sent] ),
            "@Requested", SUM ( Daily[Qty Requested] )
        ),
        "@Ratio", MIN ( 1, DIVIDE ( [@Requested], [@Sent] ) )
    )
RETURN
    AVERAGEX ( Summary, [@Ratio] )

 

Works great, thanks!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.