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
yukon
Helper I
Helper I

How to show Grand Total as Column

Hello everyone,

 

I'm trying show the grand total as column as below screenshot. I write some Dax, however it's given sub total of each values instead of Grand Total. Is it any others way to get same outcome with DAX?

 

Please find the attached for your refrences. Sample Excel File 

 

9-4-2020 10-36-57 PM.png

 

Regards,

1 ACCEPTED SOLUTION

HI @yukon,

Perhaps you can add a values filter on Dax formula, then it will group the calculation based on current row label category:

 

Measure version:
Measure =
CALCULATE (
    SUM ( 'Table'[Amount(EUR)] ),
    ALLSELECTED ( Table ),
    VALUES ( Table[Country] )
)

 

If you want to use calculate column, please check below formula:

Calculate column version:
Grand Total =
CALCULATE (
    SUM ( 'Table'[Amount(EUR)] ),
    FILTER ( ALLSELECTED ( Table ), Table[Country] = EARLIER ( Table[Country] ) )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
Mariusz
Community Champion
Community Champion

Hi @yukon 

 

You can use ALLSELETCED() like 

Measure = 
CALCULATE(
    SUM( 'Table'[Column1] ),
    ALLSELECTED()
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Hello @Mariusz ,

 

Thank for your comment and DAX sentence. I got grand total for all countries even those countries has no data. Is it possible to show the countries if sum of amount is not zero. 

 

9-4-2020 11-37-04 PM.png

 

 

HI @yukon,

Perhaps you can add a values filter on Dax formula, then it will group the calculation based on current row label category:

 

Measure version:
Measure =
CALCULATE (
    SUM ( 'Table'[Amount(EUR)] ),
    ALLSELECTED ( Table ),
    VALUES ( Table[Country] )
)

 

If you want to use calculate column, please check below formula:

Calculate column version:
Grand Total =
CALCULATE (
    SUM ( 'Table'[Amount(EUR)] ),
    FILTER ( ALLSELECTED ( Table ), Table[Country] = EARLIER ( Table[Country] ) )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help 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.