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
bartw00
Frequent Visitor

how to use rollupaddissubtotal

Hi,

 

I have a column with multiple dimesnion rows, row1, row2, row3. Besides that i have a lot of measures to reflect on this.

I want to create a pivot table. But i want row1 and row 2 to show a subtotal for all the values. Below that i want row 3 to show, but below that i want a subtotal of row1, row,2, row3. I read about rollupaddissubtotal but i could not get it to work. Any suggestions?

1 ACCEPTED SOLUTION

Hi @bartw00 

 

I've tried rollupaddissubtotal() function, but unfortunately that I don't get the correct outcome.
Maybe you can try this method as a 
alternative workaround:

First of all, add a index column in M query:

vzhengdxumsft_4-1712130465409.png

Then add a calculate column:

Subtotal =
VAR _sumAmount =
    SUMX (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Index] <= EARLIER ( 'Table'[Index] ) ),
        'Table'[Amount]
    )
RETURN
    IF (
        'Table'[Index]
            = MAXX (
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    'Table'[Level 1] = EARLIER ( 'Table'[Level 1] )
                ),
                'Table'[Index]
            ),
        _sumAmount
    )

vzhengdxumsft_5-1712130510938.png

The result is as follow:

vzhengdxumsft_6-1712130510938.png

 

 

Best Regards

Zhengdong Xu

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

3 REPLIES 3
v-zhengdxu-msft
Community Support
Community Support

Hi @bartw00 

 

Could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

 

Best Regards

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

Hi, @v-zhengdxu-msft ,

Hereby an example. The problem that i am encountering is that everythin is on the same level. When calculating subtotals for groups F.E. It only calculates the subtotals for the groups and not the totals of previuos groups. I tried creating multiple tables and send them to back, but this gives issues with publishing in terms of placing the visuals. Hereby a sample:

bartw00_1-1712122122853.png

Thanks in advance!

 

Hi @bartw00 

 

I've tried rollupaddissubtotal() function, but unfortunately that I don't get the correct outcome.
Maybe you can try this method as a 
alternative workaround:

First of all, add a index column in M query:

vzhengdxumsft_4-1712130465409.png

Then add a calculate column:

Subtotal =
VAR _sumAmount =
    SUMX (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Index] <= EARLIER ( 'Table'[Index] ) ),
        'Table'[Amount]
    )
RETURN
    IF (
        'Table'[Index]
            = MAXX (
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    'Table'[Level 1] = EARLIER ( 'Table'[Level 1] )
                ),
                'Table'[Index]
            ),
        _sumAmount
    )

vzhengdxumsft_5-1712130510938.png

The result is as follow:

vzhengdxumsft_6-1712130510938.png

 

 

Best Regards

Zhengdong Xu

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

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.