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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Sagejah9
Helper III
Helper III

Grand total not showing correct total

Hi. I am trying to show sales for different countries for a particular year and period. However the measure I created to sum isn't showing the correct total at the grand total line. 

Sales = switch(true(), country = "USA", calculate(sum(sales table[sales_amount]), channel = "Store"), calculate(sum(sales table[sales_amount]), channel <> "Store"))

 

 

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

Hi, @Sagejah9 

Please try formula as below:

Sales =
VAR a =
    SUM ( 'sales table'[sales_amount] )
VAR b =
    SUM ( 'sales table'[sales_amount] )
RETURN
    SWITCH (
        TRUE (),
        SUM ( 'sales table'[country] ) = "USA", a,
        channel = "Store", b,
        channel <> "Store"
    )

If it doesn't work, please share some relevant screenshots for further research.

 

Best Regards,
Community Support Team _ Eason

 

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @Sagejah9 

Please try formula as below:

Sales =
VAR a =
    SUM ( 'sales table'[sales_amount] )
VAR b =
    SUM ( 'sales table'[sales_amount] )
RETURN
    SWITCH (
        TRUE (),
        SUM ( 'sales table'[country] ) = "USA", a,
        channel = "Store", b,
        channel <> "Store"
    )

If it doesn't work, please share some relevant screenshots for further research.

 

Best Regards,
Community Support Team _ Eason

 

amitchandak
Super User
Super User

@Sagejah9 , try like

Sales = calculate(sum(sales table[sales_amount]), channel = "Store", country = "USA") + calculate(sum(sales table[sales_amount]), channel <> "Store", country <> "USA")

 

Use the filter in calculate, if needed

http://dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors