Forum Discussion
Switch function not working as intended
- 4 years ago
Hi Anonymous ,
First please create a new table containing the names of these measures.Then create the following measures and filter the matrix visual.
Mapping = SWITCH ( MAX ( MatrixColumns[Measure Name] ), "Total Orders", [Total Orders], "CY Orders Target", [CY Orders Target], "CY Orders Target Variance", [CY Orders Target Variance], "CY Orders Progress %", [CY Orders Progress %], "Total Revenue", [Total Revenue], "CY Revenue Target", [CY Revenue Target], "CY Revenue Progress %", [CY Revenue Progress %] )Measure = SWITCH ( [Selected Measure], "By Counts", COUNTROWS ( FILTER ( MatrixColumns, MatrixColumns[Measure Name] IN { "Total Orders", "CY Orders Target", "CY Orders Target Variance", "CY Orders Progress %" } ) ), "By Revenue", COUNTROWS ( FILTER ( MatrixColumns, MatrixColumns[Measure Name] IN { "Total Revenue", "CY Revenue Target", "CY Revenue Progress %" } ) ) )If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous , first 4 and last 3 values are same in switch, they should be different
Or you need more than one measures
Thanks for responding to my question. The logic behind that is, if the user selects "By Counts" I should show the four columns by counts and if "By Revenue" it should show the 4 fields for revenue. Any workaround to show the four corresponding fields based on a single selection? TIA