The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi community,
Let me show the example directly in the picture below...
How can I create a measure to divide 2,119 (E3) by 840 (D4) * 7? (7 days a week)
Under the picture, you can find the measure for stock projection. Really appreciate if anyone can help!
Stock Projection =
CALCULATE(
SUM(Stock[qty]) + SUM(Supply[supply_qty]) - SUM('Demand'[demand_qty]),
ALLSELECTED('Calendar'[Date_]),
ISONORAFTER('Calendar'[Date_], MAX('Calendar'[Date_]), DESC)
)
Solved! Go to Solution.
Hi @cmc910514 ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create a calculated column in Table [Demand].
Index = RANKX('Demand','Demand'[Date],,ASC,Dense)
(3) We can create a measure.
Stock days =
var _a=CALCULATE(MAX('Demand'[Demand]),FILTER(ALLSELECTED('Demand'),'Demand'[Index]=MAX('Demand'[Index])+1))
return DIVIDE([Stock Projection],_a)*7
(4) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @cmc910514 ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) We can create a calculated column in Table [Demand].
Index = RANKX('Demand','Demand'[Date],,ASC,Dense)
(3) We can create a measure.
Stock days =
var _a=CALCULATE(MAX('Demand'[Demand]),FILTER(ALLSELECTED('Demand'),'Demand'[Index]=MAX('Demand'[Index])+1))
return DIVIDE([Stock Projection],_a)*7
(4) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
14 | |
12 | |
8 | |
6 | |
5 |
User | Count |
---|---|
28 | |
19 | |
13 | |
7 | |
5 |