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

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.

Reply
vmakhija
Post Prodigy
Post Prodigy

SUMMARIZECOLUMNS question

Hello

I am creating a table using SUMMARIZECOLUMNS.

My original data looks as follows -

 

All_Data.JPG

 

As you can see, there is only 1 category under India.

 

My table DAX created using SUMMARIZECOLUMNS is as follows -

 

SummarizeTable = SUMMARIZECOLUMNS ( ListOfOrders[Country], OrderBreakdown[Category],FILTER('ListOfOrders', 'ListOfOrders' [Country] = "India") )
 
And its output is as follows -
SummarizeColumnsOutput.JPG
 
However, as per this output, I am seeing all categories under India which is incorrect.
 
What could be the reason for this?
 
Regards
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @vmakhija 

SUMMARIZECOLUMNS without a calcualted value performs a CROSSJOIN on the columns and has no way to apply a filter to limit the returned rows (It doesn't know there is no data for India - Technology).

You can use summarize over the detail table then feed in the higher level columns and it will only return values that are represented in the lower level table.  Something like

SummarizeTable =
CALCULATETABLE (
    SUMMARIZE ( OrderBreakdown, ListOfOrders[Country], OrderBreakdown[Category] ),
    'ListOfOrders'[Country] = "India"
)

This code assumes OrderBreakdown is the bigger detail table and ListOfOrders is joined to it as the 1 side of a *:1

 

As and example, this code would give me all of the Subcategory values that are represented in the Sales table and leave out any that are not.

Table = SUMMARIZE(Sales,'Product Subcategory'[Subcategory])

View solution in original post

1 REPLY 1
jdbuchanan71
Super User
Super User

Hello @vmakhija 

SUMMARIZECOLUMNS without a calcualted value performs a CROSSJOIN on the columns and has no way to apply a filter to limit the returned rows (It doesn't know there is no data for India - Technology).

You can use summarize over the detail table then feed in the higher level columns and it will only return values that are represented in the lower level table.  Something like

SummarizeTable =
CALCULATETABLE (
    SUMMARIZE ( OrderBreakdown, ListOfOrders[Country], OrderBreakdown[Category] ),
    'ListOfOrders'[Country] = "India"
)

This code assumes OrderBreakdown is the bigger detail table and ListOfOrders is joined to it as the 1 side of a *:1

 

As and example, this code would give me all of the Subcategory values that are represented in the Sales table and leave out any that are not.

Table = SUMMARIZE(Sales,'Product Subcategory'[Subcategory])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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