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.
Hey all,
I got a problem to calculate the weeks of coveage based on the forward looking demands (see below example)
Item A: Weeks of coverage = 8/11 = 0.72
Item A: Because the first 5 weeks demands is 33. By the end of the 5th weeks, the leftover inventory is about 18 = 51-1-1-5-11-15. Given that, we only can fulfill 90% of the 6th week demands, which is 18 / 20 = 0.9. SO Item B 's weeks of coverage is about 5.9.
Do you know what logic or how we can apply in BI to calculate that? Thanks!
Hey all,
That's my thoughts. (see below example) I'm now stuck to transfer that way of calculation into dax. Do you have any ideas how in dax? Thanks!
Steps:
1: Add the running total column to highlight the cumulative demands
2: mark "1" if we can hit that day's running total demands (day 1 thru day 6)
3: for the day which we cannot cover the running total (day 7). I will use the leftover which i have at the end of day 6 ( 9 = 100 - 91). And then use 9 units divided by that day (day 7) demands. 9 / 110 = 0.08. In other words, we only can cover 0.08 days of day 7 demands.
4: add those days of coverage together. So total will be 6.08 days coverage.
HI @naoyixue1,
I enter to the query editor to use the 'unpivot column' and 'replace value' function on your table to change its structure for following calculations.
Measure formula:
formula =
VAR currItem =
SELECTEDVALUE ( 'Table'[Item] )
VAR summary =
SUMMARIZE (
ALLSELECTED ( 'Table' ),
[Item],
[Inventory],
[Days],
"Rolling",
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( ALLSELECTED ( 'Table' ), [Days] <= MAX ( 'Table'[Days] ) ),
VALUES ( 'Table'[Item] )
)
)
VAR days =
MAX (
MAXX (
FILTER ( summary, [Item] = currItem && [Rolling] <= [Inventory] ),
[Days]
),
1
)
RETURN
IF (
days = 1,
CALCULATE (
DIVIDE ( MAX ( 'Table'[Inventory] ), MAX ( 'Table'[Value] ) ),
FILTER ( ALLSELECTED ( 'Table' ), [Days] = 1 ),
VALUES ( 'Table'[Item] )
),
VAR rolling =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( ALLSELECTED ( 'Table' ), [Days] <= days ),
VALUES ( 'Table'[Item] )
)
RETURN
days
+ CALCULATE (
DIVIDE ( MAX ( 'Table'[Inventory] ) - rolling, MAX ( 'Table'[Value] ) ),
FILTER ( ALLSELECTED ( 'Table' ), [Days] = days + 1 ),
VALUES ( 'Table'[Item] )
)
)
Regards,
Xiaoxin Sheng
@v-shex-msft Thanks Xiaoxin. Let me check that. Really appreicate that. Will let you know after test.
Hey all, sorry i just check to see whehter you all have some thoughts? I really don't find any similar problems here. Thanks a lot!
Does anyone have any thoughts about how? Thanks!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |