Forum Discussion
Dynamic Measure with Fieldparameters
- 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.
Hi showy,
Wanted to let you know that Filed Parameters are return column reference (Value1, Value2, etc) not Numbers(3,00, 2,50, etc). To Fix this issue use SWITCH DAX logic as mentioned below.
_Measure =
VAR SelectedField = SELECTEDVALUE('FieldParameterPrice'[FieldParameterPrice Fields])
VAR SelectedPrice =
SWITCH (
SelectedField,
"Value1", SELECTEDVALUE(D_Item[Value1]),
"Value2", SELECTEDVALUE(D_Item[Value2]),
"Value3", SELECTEDVALUE(D_Item[Value3]),
"Value4", SELECTEDVALUE(D_Item[Value4])
)
RETURN
[SUM of Qty] * SelectedPrice
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.
- showy1 year agoHelper II
Hi thanks for your reply.
I tried it but when i select a Value i got an empty values as result.- ajaybabuinturi1 year agoSuper User
Hi showy, could you please share some sample data of .pbix file
- showy1 year agoHelper II
Hi here are the data and the pbix
https://www.dropbox.com/scl/fo/vd9sbbu444cq9bxtprkte/ABIkKw_t_kwAK9dUwMqsIsc?rlkey=wo53sxpy4n7ylqlw6mf6c72qx&st=tg3jhqx5&dl=0