Forum Discussion
Dynamic value calculation based on input
- 3 years ago
Hi sadiahsapiee
Please tryTotal Cost of Critical = VAR T1 = ADDCOLUMNS ( VALUES ( 'Table'[Component] ), "@Cost", CALCULATE ( SELECTEDVALUE ( 'Table'[Cost] ) ), "@Category", [Category] ) VAR T2 = FILTER ( T1, [@Category] = "Critical" ) RETURN SUMX ( T2, [@Cost] )
sadiahsapiee
Sorry I did not understand the question. Would you please clarify further perhaps more details and some screenshots.
After we get total Cost of Critical Category from previous formula, i want to calculate cost cumulation using delivery time low to high
What i did before( without considering category)
1.
Cost_Cumulation =
CALCULATE(SUM'Table1'[Cost], ALL('Table1'[Component]),
FILTER(ALL('Table'[Delivery Time),AND('Table'[Delivery Time >=MIN('Table'[Delivery Time]), NOT(ISBLANK('Table'[Delivery Time])))))
2.
% Cost Cumulation = [Cost Cumulation]/ CALCULATE([Cost Cumulation], 'Table1'[Delivery Time]=0)
Now the calculation need to consider Critical category only.
thank in advance for your support.
- tamerj13 years agoCommunity Champion
Hi sadiahsapiee
please try
Cumulative Cost of Critical = VAR CurrentDeliveryTime = SELECTEDVALUE ( 'Table'[Delivery Time] ) VAR T1 = ADDCOLUMNS ( ALLSELECTED ( 'Table'[Component] ), "@Cost", CALCULATE ( SELECTEDVALUE ( 'Table'[Cost] ) ), "@Category", [Category], "@DeliveryTime", CALCULATE ( SELECTEDVALUE ( 'Table'[Delivery Time] ) ) ) VAR T2 = FILTER ( T1, [@Category] = "Critical" && [@DeliveryTime] >= CurrentDeliveryTime ) RETURN SUMX ( T2, [@Cost] )