Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I current have a table as follows;
Category A | Category B | Category C | Category D | |
Value 1 | 1 | 1 | 1 | 1 |
Value 2 | 1 | 1 | 1 | 1 |
Value 3 | 1 | 1 | 1 | 1 |
Value 4 | 1 | 1 | 1 | 1 |
Value 5 | 1 | 1 | 1 | 1 |
Value 6 | 1 | 1 | 1 | 1 |
Each of the values in the above table is based on a calculated measure. My problem that I am facing is that I would liek to group values, in order to expand and minise rows based on grouping of the values. For example;
Category A | Category B | Category C | Category D | ||
Group 1 | |||||
Value 1 | 1 | 1 | 1 | 1 | |
Value 2 | 1 | 1 | 1 | 1 | |
Group 2 | |||||
Value 3 | 1 | 1 | 1 | 1 | |
Value 4 | 1 | 1 | 1 | 1 | |
Group 3 | |||||
Value 5 | 1 | 1 | 1 | 1 | |
Value 6 | 1 | 1 | 1 | 1 |
I appreciate that the matric has a +/- function in the formatting for rows, but given that my values are based off calculated measures, I don't have this functionality. A way around this would be perfect, so all help is much appreciated!
Thannks
Solved! Go to Solution.
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:
See attach result.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @Anonymous ,
As far as i know, Matrix visual is the most common way to expand and collapse rows by groups but measure can only be add to Values field of matrix visual. So there are two ways I can think of.
The first way is using Calculated Column to get the values instead of Measure.
The second way is creating a Calculated Table based on the measure and table.
As i don't know the formula of your Measure, so i did a simple example about the second way.
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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:
See attach result.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi 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.
Hi @JLebens ,
Witouht any further details about what you are calculating is difficult to suggest anything.
What are the the calculations you are making?
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHello, 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!
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.
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.
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
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
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi,
I'm still having some issues with this one. Below shows what my table actually looks like;
Please note the following;
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi, thanks for getting back to me. Unfortunately I can't open your sample attachment as it's a using a newer version than what I currently have installed. The problem I have is that it a whole rigmarole to get our IT department to update the version I have 😞
My question though is, with regards to step one and creating the table, is this a standard table made from scratch, (enter data) or is this built using the values i currently have?
PS. How do I add a sample to the reply?
Hi @Anonymous ,
It's a simple table made by inputing the information, but you can make it in an excel spreadsheet or similar.
You can add the sample by using a onedrive, googledrive, dropbox or we transfer similar links.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi,
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
Hi @Anonymous ,
You need to follow what I refer creating a table with the grouping and the name of the measures and then using a switch function for making the calculation within the matrix.
Have you checked out the PBIX file I have attached to the post?
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsCovering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |