Forum Discussion
Grouping calculated measures as values in a matrix
- 6 years ago
Hi Anonymous ,
Create a table with the following format:
Measure Group
Value 1 Group 1 Value 2 Group 1 Value 3 Group 2 Value 4 Group 2 Value 5 Group 3 Value 6 Group 3 Now add the following measure:
Grouping Calculation = VAR Group_calculation = SWITCH ( SELECTEDVALUE ( 'Grouping_Measures'[Group] ); "Group 1"; [Value 1] + [Value 2]; "Group 2"; [Value 3] + [Value 4]; "Group 3"; [Value 5] + [Value 6] ) RETURN SWITCH ( SELECTEDVALUE ( 'Grouping_Measures'[Measure] ); "Value 1"; [Value 1]; "Value 2"; [Value 2]; "Value 3"; [Value 3]; "Value 4"; [Value 4]; "Value 5"; [Value 5]; "Value 6"; [Value 6]; Group_calculation )Format your matrix with the following way:
- Rows:
- Grouping_Measures[Group]
- Grouping_Measures[Measure]
- Columns
- Table[Category]
- Values
- [Groupin Calculation]
See attach result.
- Rows:
Hi Anonymous ,
Create a table with the following format:
Measure Group
| Value 1 | Group 1 |
| Value 2 | Group 1 |
| Value 3 | Group 2 |
| Value 4 | Group 2 |
| Value 5 | Group 3 |
| Value 6 | Group 3 |
Now add the following measure:
Grouping Calculation =
VAR Group_calculation =
SWITCH (
SELECTEDVALUE ( 'Grouping_Measures'[Group] );
"Group 1"; [Value 1] + [Value 2];
"Group 2"; [Value 3] + [Value 4];
"Group 3"; [Value 5] + [Value 6]
)
RETURN
SWITCH (
SELECTEDVALUE ( 'Grouping_Measures'[Measure] );
"Value 1"; [Value 1];
"Value 2"; [Value 2];
"Value 3"; [Value 3];
"Value 4"; [Value 4];
"Value 5"; [Value 5];
"Value 6"; [Value 6];
Group_calculation
)
Format your matrix with the following way:
- Rows:
- Grouping_Measures[Group]
- Grouping_Measures[Measure]
- Columns
- Table[Category]
- Values
- [Groupin Calculation]
See attach result.
- Anonymous6 years agoNot applicable
Thanks for the quick reply. Is it possible to complete the first step given that the values are the results of calculated measures I have created?
Thanks
- MFelix6 years ago
Super User
Hi Anonymous ,
The values that I have created in my file are several measures named Value 1, ..., Value 6. I assumed that what you mean by calculated measures right?
Can you please explain what you mean by complet the first step?
Regards,
MFelix
- Anonymous6 years agoNot applicable
Hi,
My apologies for not being very clear. The groupings are what I hope to create using the calculated measures that I currently have as measures. For example, Grouping values 1 & 2 into Group 1, so that I can use the groupings as rows. Hope this makes sense.
Thanks
- Anonymous6 years agoNot applicable
Hi, me again!
Firstly, thanks very much for your help with the solution to my problem. I have an additional step to this that I need some help with...
I have successfully created the groups within the table, and now would like to conditionally format some fo the values in the groups based on the results. The problem I have is that because I'm using just the one measure, based on the above, I can't conditionallly format any of the individual rows using the conditional formatting section of the format tab. I'm guessing I going to have to add some additional DAX to the existing grouping measure, or possibly amend the original measure that the grouping DAX references?
Any idea how I could get aroudn this.
Hope this makes sense.
- Anonymous5 years agoNot applicable
Hello, thanks for the solution!
My measures are different types and want to format some of them as a whole number and some of them as a percentage. Is it possible? I tried to do it in your sample file but can't get the results.Thanks in advance!
- Anonymous5 years agoNot applicable
I've found the solution, maybe someone else needs it. So in measures the function FORMAT(measure, "Percent") works fine. Any measure can have own format in this way.
- JLebens4 years agoFrequent Visitor
Hi MFelix,
Thank you for sharing the solution to this problem.
This looks like exactly what I'm looking for, but creating the Grouping Calculation measure in my report results in an infinite "Working on it". Do you have any suggestions as to how to prevent this?
Thanks in advance. Kind regards.