Forum Discussion
showy
1 year agoHelper II
Dynamic Measure with Fieldparameters
Hello I have some sample data here. I have a D_Item with the article 12345, which has 4 values (Value 1 - Value 4) In the fact table I have a few quantities for the article 12345. The...
- 1 year ago
showy could you please use beow updated measure to get correct Grand Total.
_Measure(Updated)2 = Var SelectedColumn = SELECTEDVALUE('PriceFields'[PriceColumn]) Var Result = SUMX(D_Item, Var Quantity = CALCULATE(SUM(F_Sales[Quantity])) Var SelectedPrice = SWITCH (SelectedColumn, "Price1", D_Item[Price1], "Price2", D_Item[Price2], "Price3", D_Item[Price3], "Price4", D_Item[Price4], BLANK()) Var Result = Quantity * SelectedPrice //Final Result1 Var Result2 = IF(ISBLANK(SelectedPrice), Quantity, Quantity * SelectedPrice) //Final Result2 RETURN Result2 //Based on business needs chose any one result ) RETURN ResultThanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.
ajaybabuinturi
1 year agoSuper User
showy could you please use beow updated measure to get correct Grand Total.
_Measure(Updated)2 =
Var SelectedColumn = SELECTEDVALUE('PriceFields'[PriceColumn])
Var Result =
SUMX(D_Item,
Var Quantity = CALCULATE(SUM(F_Sales[Quantity]))
Var SelectedPrice = SWITCH (SelectedColumn,
"Price1", D_Item[Price1],
"Price2", D_Item[Price2],
"Price3", D_Item[Price3],
"Price4", D_Item[Price4],
BLANK())
Var Result = Quantity * SelectedPrice //Final Result1
Var Result2 = IF(ISBLANK(SelectedPrice), Quantity, Quantity * SelectedPrice) //Final Result2
RETURN
Result2 //Based on business needs chose any one result
)
RETURN
Result
Thanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.
showy
1 year agoHelper II
Thanks that works very well 🙂