Forum Discussion
Showing Multiple Measure in one bar chart cleanly
- Anonymous7 years ago
Hi ,
Bit of a workaround but you could create a new table (by using Enter Data) with the name of your measures:
Table Name: Aware
Aware Headers:
Aware Brand1
Aware Brand2
Aware Brand3
Aware NoneThen create a switch statement like the below:
SWITCH (
MIN ( 'Aware'[Aware Headers] ),
"Aware Brand1", [Aware Brand1],
"Aware Brand2", [Aware Brand2],
"Aware Brand3", [Aware Brand3],
"Aware None", [Aware None]
)Use the switch statement above as your value and use your Column Headers from the table as your X axis
As far as I am aware the Min fuction is ensuring only one value is passed through to the Switch function when it is searching through each of the values. Docs.Microsoft sums it up nicely. For switch you need to have - "Any DAX expression that returns a single scalar value, where the expression is to be evaluated multiple times (for each row/context)."
In the mean time I have developed what I think is a better approach to this issue. (I am talking about research data here, so row level per respondent with these multi-choice questions) I create a duplicate of my main data table. just with Respondent ID, and the multi choice questions. I then use unpivot to give me a flat table. Which looks like this
RespondentID Value
1 Aware Brand 1
1 Aware Brand 2
2 Aware Brand 1
3 Aware brand 2
3 Aware brand 3
I then link this back to the main table via respondent ID and you can easily build charts from this. You can even add a third column to this being question number and then have all of your multiple choice questions within one table.
This is much more efficent from a data model persepctive as I found the Switch function was killing performance when I had alot of them in the tables with lots of brands.
Hope that helps.
Thank you so much for taking the time to come back and report on this - I was struggling with something similar and you helped!