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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
PBI-Bro
Advocate II
Advocate II

Can't calculate cumulative sum

Hi,

I'm trying to do the simplest calculation here. A have a table with a Date Key column and a colum "IsPayday", which is of Type Whole number.

I want to have a running total of the second one and have tried many variations of the formula below, but haven't figured it out:

 

PBIBro_0-1666882071773.png

Thanks for your help!

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

try

Is Payday running total =
VAR MaxDate =
    MAX ( 'Calendar'[Datekey] )
VAR Result =
    CALCULATE ( SUM ( 'Calendar'[Is payday] ), 'Calendar'[Datekey] <= MaxDate )
RETURN
    Result

View solution in original post

4 REPLIES 4
PBI-Bro
Advocate II
Advocate II

Thank for your help.

 

I decided to change the source data and add ispayday as boolean in the data warehouse. With the field imported into Power BI I used the following variation of your code and got the calculation working:

 

 

Is Payday running total = 
VAR MaxDate =
    MAX ( 'Calendar'[Datekey] )
VAR Result =
    CALCULATE(COUNTROWS('Calendar'), 'Calendar'[Datekey] <= MaxDate && 'Calendar'[ispayday] = true )
RETURN
    Result

 

 

johnt75
Super User
Super User

try

Is Payday running total =
VAR MaxDate =
    MAX ( 'Calendar'[Datekey] )
VAR Result =
    CALCULATE ( SUM ( 'Calendar'[Is payday] ), 'Calendar'[Datekey] <= MaxDate )
RETURN
    Result

Thanks for your help @johnt75 

 

I tried it and have this error:

PBIBro_0-1666885903789.png

 

IsPayday is a custom column that I created in the Power Query Editor. Can that be the problem?

You have an extra ] after IsPayday

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.