Forum Discussion
Creating a Summary Table - Consolidating Multiple Lines With More Than One Unique Data Element
I have a report that shows all the lines associated with an order number. The problem is that in a few select cases the multiple lines of an order will contain a two or more unique "Line Category". Because I am summarzing this table by "Order #" and don't want a line for each "Line Category", I am trying to figure out how I can essentially create a column called "Final Category". Basically, if for any "Order #" there is two or more different "Line Category", I want the "Final Category" to simply say "Multi" for all the lines. If there is only 1 "Line Category", then it will pull over the specific category for each field. This will enable me to summarize my report using the "Final Category" field and only have one line per order number.
Does anyone know how I can best do this? Here is an example of what I am looking for, especially with "Order #" 1.
- Anonymous3 years ago
Hi Anonymous ,
I have created a simple smaple, please refer to it to see if it helps you.
Create a measure.
Measure = CALCULATE(DISTINCTCOUNT('Table'[line hcart]),FILTER(ALL('Table'),'Table'[Order]=SELECTEDVALUE('Table'[Order])))Then create the table.
Table 2 = SUMMARIZE('Table','Table'[Order],'Table'[line hcart],"aaa",SWITCH(TRUE(),[Measure]=1,'Table'[line hcart],"Mult"))How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ PollyIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 Replies
- AnonymousNot applicable
Hi Anonymous ,
I have created a simple smaple, please refer to it to see if it helps you.
Create a measure.
Measure = CALCULATE(DISTINCTCOUNT('Table'[line hcart]),FILTER(ALL('Table'),'Table'[Order]=SELECTEDVALUE('Table'[Order])))Then create the table.
Table 2 = SUMMARIZE('Table','Table'[Order],'Table'[line hcart],"aaa",SWITCH(TRUE(),[Measure]=1,'Table'[line hcart],"Mult"))How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ PollyIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Anonymous Thank you! This worked great. I should be able to replicate this in other areas too.
- PadycosmosSolution Sage
You can create a summary table using the SUMMARIZE() dax function
https://learn.microsoft.com/en-us/dax/summarize-function-dax
- AnonymousNot applicable
I am familiar with the summarize function, but what I don't know how to do is create the "Final Category" column that looks at all the lines associated with a single order number and generates "Multi" if there are more than one distinct text values in the "Line Category".
- PadycosmosSolution Sage
You may try SWITCH(TRUE(),distinctcount(LineCategory)>1, "Multi",Max(LineCategory),
within the SUMMARIZE()