Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
mkusler
Helper II
Helper II

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.

 

example.png

 

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @mkusler ,

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"))

vpollymsft_0-1673834078508.png

 

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 _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-rongtiep-msft
Community Support
Community Support

Hi @mkusler ,

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"))

vpollymsft_0-1673834078508.png

 

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 _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-rongtiep-msft Thank you! This worked great. I should be able to replicate this in other areas too.

Padycosmos
Solution Sage
Solution Sage

You may try SWITCH(TRUE(),distinctcount(LineCategory)>1, "Multi",Max(LineCategory),

within the SUMMARIZE()

Padycosmos
Solution Sage
Solution Sage

You can create a summary table using the SUMMARIZE() dax function

https://learn.microsoft.com/en-us/dax/summarize-function-dax

 

@Padycosmos 

 

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".

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.