cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bseefelt
Regular Visitor

DAX equivalent of GROUP BY CUBE ()

 

I'm using SUMMARIZE(...ROLLUP...) in DAX which accomplishes the same as a GROUP BY ROLLUP() in T-SQL and so far so good.

 

Is there a DAX statement that will do the same as GROUP BY CUBE()? I want to get all the other permutations of rollup as well.

 

Thanks.

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft
Microsoft

@bseefelt

 

You should be able to use SUMMARIZECOLUMNS(...ROLLUPADDISSUBTOTAL..) in DAX to do the same as GROUP BY CUBE() in T-SQL. See my sample below.

 

Assume we have a table called "Inventory" like below.

T1.PNG

Then we should be able to use the formula below to create a summary table the same as GROUP BY CUBE().

Table 2 = 
SUMMARIZECOLUMNS (
    ROLLUPADDISSUBTOTAL ( Inventory[Item], "IsItemSubTotal" ),
    ROLLUPADDISSUBTOTAL ( Inventory[Color], "IsColorSubTotal" ),
    "TotalQuantity", SUM ( Inventory[Quantity] )
)

T2.PNG

 

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Microsoft
Microsoft

@bseefelt

 

You should be able to use SUMMARIZECOLUMNS(...ROLLUPADDISSUBTOTAL..) in DAX to do the same as GROUP BY CUBE() in T-SQL. See my sample below.

 

Assume we have a table called "Inventory" like below.

T1.PNG

Then we should be able to use the formula below to create a summary table the same as GROUP BY CUBE().

Table 2 = 
SUMMARIZECOLUMNS (
    ROLLUPADDISSUBTOTAL ( Inventory[Item], "IsItemSubTotal" ),
    ROLLUPADDISSUBTOTAL ( Inventory[Color], "IsColorSubTotal" ),
    "TotalQuantity", SUM ( Inventory[Quantity] )
)

T2.PNG

 

Regards

That worked perfectly.  Thank you so much!

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.