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
vinothkumar1990
Helper II
Helper II

Table Matrix Report Total Sum Issue

Hi All,

I have requirement to calculate the cumulative sales for each month with the below rows and columns.
Rows - Region and Country
Column - Mon-YYYY
Values - Sales (Sales Amount)

Sample calculation from below data,
For Asia Region, Sales amount is on Apr-24 is 3000, May-24 is 8000 (3000+5000) and Jun-24 sales amount is 15000 (3000+5000 + 7000)

 

RegionCountryMon-YYYYSales Amount
AsiaIndiaApr-241000
AsiaSrilankaApr-242000
AfricaSouth AfricaApr-243000
EuropeFranceApr-244000
EuropeGermanyApr-245000

North America
USAApr-246000
AsiaIndiaMay-242000
AsiaSrilankaMay-243000
AfricaSouth AfricaMay-244000
EuropeFranceMay-245000
EuropeGermanyMay-246000

North America
USAMay-247000
AsiaIndiaJun-243000
AsiaSrilankaJun-244000
AfricaSouth AfricaJun-245000
EuropeFranceJun-246000
EuropeGermanyJun-247000

North America
USAJun-248000

 

I created the below measure which is give me proper result at Country Level but not at Region level

Sales =
       CALCULATE(
                    SUM(Sales[Sales Amount]),
                        FILTER(ALL(Sales),
                              Sales[Mon-YYYY] <= MAX(Sales[Mon-YYYY]) &&
                              Sales[Region] = MAX(Sales[Region]) &&
                              Sales[Country] = MAX(Sales[Country])
                              )
        )


My report result:

vinothkumar1990_0-1712213283737.png

 


Note - I have state field as well to include after the country. Since i want to my query in simple manager, i kept only Region and Country.

Thanks for your help in advance!
 

1 ACCEPTED SOLUTION
Uzi2019
Super User
Super User

Hi @vinothkumar1990 

Try below Calculated column not measure.

Sales 2 = CALCULATE (
    SUM ( 'Region Sale'[Sales Amount]),
    FILTER (
        FILTER ( 'Region Sale', 'Region Sale'[Country] = EARLIER ( 'Region Sale'[Country] ) ),
        'Region Sale'[Mon-YYYY] <= EARLIER ( 'Region Sale'[Mon-YYYY] )
    )
)
 
Uzi2019_0-1712217664730.png

 

 

I hope this works for you.!

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

View solution in original post

1 REPLY 1
Uzi2019
Super User
Super User

Hi @vinothkumar1990 

Try below Calculated column not measure.

Sales 2 = CALCULATE (
    SUM ( 'Region Sale'[Sales Amount]),
    FILTER (
        FILTER ( 'Region Sale', 'Region Sale'[Country] = EARLIER ( 'Region Sale'[Country] ) ),
        'Region Sale'[Mon-YYYY] <= EARLIER ( 'Region Sale'[Mon-YYYY] )
    )
)
 
Uzi2019_0-1712217664730.png

 

 

I hope this works for you.!

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.