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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
Community Champion
Community Champion

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
Community Champion
Community Champion

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors