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
Aymane
Frequent Visitor

Create a calculated column for cumulative sum by Date

I'm trying to create a calculated column that calculates the cumulative sum. I created one in a DAX measure and its working fine:

 

CumulativeCount =
CALCULATE(
     SUM(Fact_CRM_CT[Count]),
    FILTER(ALLSELECTED(Fact_CRM_CT),Fact_CRM_CT[DateKey] <= MAX(Fact_CRM_CT[DateKey]) ))
 
I want to recreate the same in a calculated column but it is not working as expected.
1 ACCEPTED SOLUTION

Hi, @Aymane 

You are using a calculated column instead of measure column to display the result, so the final result is aggregated without recomputing.

You just need to change the summarize type of  calculated column 'Cumulative Count' from 'Sum' to 'Maximum'/'Minimum'/'Average'.

veasonfmsft_0-1661223298854.png

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
Aymane
Frequent Visitor

Hi @amitchandak,

 

Thanks for your response.

 

I have tried your solution but it still doesn't give the correct output as you can see below:

Aymane_0-1659615212772.png

 

Hi, @Aymane 

You are using a calculated column instead of measure column to display the result, so the final result is aggregated without recomputing.

You just need to change the summarize type of  calculated column 'Cumulative Count' from 'Sum' to 'Maximum'/'Minimum'/'Average'.

veasonfmsft_0-1661223298854.png

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@Aymane , a new column

CumulativeCount =
CALCULATE(
SUM(Fact_CRM_CT[Count]),
FILTER((Fact_CRM_CT),Fact_CRM_CT[DateKey] <= earlier(Fact_CRM_CT[DateKey]) ))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

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.