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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ashc_cool10
Helper III
Helper III

Cumulative total by Month

Hi There,

Hope you are doing well.

I am trying to create on measure where i want Cummulative total of amount by per month.

I have month and year column which is in Text format and i want am not sure how to create cummlative total as i dont have any date available.

Please see below table with sample data . I am expecting the result is which is in "Cummulative Total " coulumn.

 

cummulative total.JPG

 

Request you to please help me in the same @Ashish_Mathur 

 

Thanks,

Ashish

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@ashc_cool10 You can create a column like this:

YearMonth = [Year] * 100 + [Month]

Then use something like this:

Better Running Total - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

@ashc_cool10 You can create a column like this:

YearMonth = [Year] * 100 + [Month]

Then use something like this:

Better Running Total - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 

 

Thank you ever so much for your quick response. The solution which you provided works .

Thanks alot.

 

Cheers!

Ashish

MohammadLoran25
Super User
Super User

Hi @ashc_cool10 ,

 

Follow these steps:

 

1-Create a calculated column in your table as:

 

YearMonth = CONVERT(CONCATENATE(TABLEofSales[Year],IF(TABLEofSales[Month]<10,CONCATENATE("0",TABLEofSales[Month]),TABLEofSales[Month])),INTEGER)
 
2-Then Create another Calculated Column:
 
YearMonthOrderIndex = RANKX(TABLEofSales,TABLEofSales[YearMonth],TABLEofSales[YearMonth],ASC,DENSE)
 
Then Create the measure below to achieve your desired result:
 
CumulativeSales =
CALCULATE (
    SUM ( TABLEofSales[Amount] ),
    FILTER (
        ALL ( TABLEofSales ),
        TABLEofSales[YearMonthOrderIndex] <= MAX ( TABLEofSales[YearMonthOrderIndex] )
    )
)
 
If this answer solves your problem, please mark it as an accepted solution so the others would find what they need easier.
Regards,
Loran

Hi @MohammadLoran25,

Thank you for the solution . I will try this one also as i was in a hurry and tried above and that works for me. 

But thank you for the solution

You're welcome.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.