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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
wlknsnBI
Helper II
Helper II

Cumulative Total with multiple levels and ranked by measure

I posted this earlier, but I reduced some complexity as the model wasn't ideal.

 

I have the following model:

wlknsnBI_0-1600368807658.png

I'm trying to get the cumulative total quantity by each order of each bom item ranked by measure order. The output should be something like:

wlknsnBI_1-1600368925274.png

 

The complexity comes from having multiple levels.

 

Hereby also the  pbix 



1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @wlknsnBI ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1600679197248.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-lionel-msft
Community Support
Community Support

Hi @wlknsnBI ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1600679197248.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

the total quantities are now no longer correct but your measure is (I can fix those quantities myself). 

 

Nice solution by the way!

 

Big thanks.

amitchandak
Super User
Super User

@wlknsnBI , Please find the attached file after the signature. Check for measure

Hi there, this is promising however, the cumaltive total is now no longer ranked by a measure. The measure which should rank the cumulative total is  Order Rank Expected Delivery =

// Rank to calculate the Order prioritization for stock requirements.
VAR __CurrentSelection =
SELECTEDVALUE ( Orders[Expected Delivery] )
VAR __DatesGreaterThanCurrentSelection =
FILTER ( ALL (Orders[Expected Delivery] ), Orders[Expected Delivery] <= __CurrentSelection )
VAR Result =
COUNTROWS ( __DatesGreaterThanCurrentSelection )
RETURN
Result
 
When I replace what you did here (in red), the total nu longer calculates correctly:
(and I need to have this by measure because the real sample has a complex ranking based on multiple criteria, so it can't be based on existing columns)

Measure =
VAR _Rank = [Order Rank Expected Delivery]
RETURN

CALCULATE(
CALCULATE(
sumx(
Orders,
[Total Ordered Quantity]
),
VALUES('Product Boms'[Bom Item]),
VALUES(Orders[Order])),
FILTER(ALLSELECTED(Orders),
[Order Rank Expected Delivery] >= _Rank),
FILTER(ALLSELECTED('Product Boms'), 'Product Boms'[Bom Item] =max('Product Boms'[Bom Item])))
 
 
Any idea how to resolve this?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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