Forum Discussion
SWITCH measures - sorting issue
- Anonymous1 year ago
Hi AndySmith,
I think your issue is based on your data model. Could you share a sample file with us and hsow us a screenshot with the result you want. This will make it easier for us to find the solution.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi AndySmith - please find the modified measure for %
Switch - Customer TimeFrame - Discount % =
VAR SelectedFrame = SELECTEDVALUE('Slicer - TimeFrame'[Select Time Frame], "MTD")
VAR DiscountResult =
SWITCH(
TRUE(),
SelectedFrame = "MTD", CALCULATE([VE - Discount % MTD]),
SelectedFrame = "YTD", CALCULATE([VE - Discount % FYTD]),
SelectedFrame = "MAT", CALCULATE([VE - Discount % MAT]),
SelectedFrame = "Date Range", CALCULATE([VE - Discount %]),
0
)
RETURN DiscountResult
common cause for disappearing values when sorting is the presence of blank values in the measure.
Switch - Customer TimeFrame - Discount % =
VAR SelectedFrame = SELECTEDVALUE('Slicer - TimeFrame'[Select Time Frame], "MTD")
VAR DiscountResult =
SWITCH(
TRUE(),
SelectedFrame = "MTD", COALESCE([VE - Discount % MTD], 0),
SelectedFrame = "YTD", COALESCE([VE - Discount % FYTD], 0),
SelectedFrame = "MAT", COALESCE([VE - Discount % MAT], 0),
SelectedFrame = "Date Range", COALESCE([VE - Discount %], 0),
0
)
RETURN DiscountResult
check with the above measure, hope it works in your scenerio