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
cgardyne
Helper I
Helper I

Sum values based on Axis date

I currently have a measure which gives me a running balance of a product based on date as follows:

 

Running Total Computers = CALCULATE (
    SUMX (Loans, Loans[Amount] + Loans[Fee] ),
    FILTER ( 
        ALL ( Loans ),
        Loans[Sixy Days After SignUp] <= MAX(Loans[Sixy Days After SignUp])                     
        && Loans[LoanProductId] = 1
    )
)

In my graph I use Loans[Sixy Days After SignUp] as an Axis and this works well.

 

But what I need to do now is go back 60 days from today which I also have a measure called Loans[Sixy Days From Today] and from this date until today calculate the days balance for a Loan based on product. Not a running balance, just a one off balance for the day and then plot that on the graph.

 

Any ideas? I can share the pbix file if needed.

1 ACCEPTED SOLUTION

Hi @cgardyne,



the last problem I need is on the days where there's no loans for it to record as 0?

Could you try add '+ 0' after SUMX (Loans, Loans[Amount] + Loans[Fee]) to see if it works? Smiley Happy

Running Total Computers =
CALCULATE (
    SUMX ( Loans, Loans[Amount] + Loans[Fee] )
        + 0,
    FILTER (
        ALL ( Loans ),
        Loans[User Sign Up Date] >= MIN ( 'Calendar'[Date] )
            && Loans[User Sign Up Date] <= MAX ( 'Calendar'[Date] )
            && Loans[LoanProductId] = 1
    )
)

 

Regards

View solution in original post

2 REPLIES 2
cgardyne
Helper I
Helper I

Ok I've changed the approach a bit. I've now added a Calendar table which has a row for each day back 60 days. I'm now using that as my Axis on the graph and my measure has changed to:

 

Running Total Computers = CALCULATE (
    SUMX (Loans, Loans[Amount] + Loans[Fee]),
    FILTER ( 
		ALL (Loans),
		Loans[User Sign Up Date] >= Min('Calendar'[Date]) && Loans[User Sign Up Date] <= Max('Calendar'[Date]) && Loans[LoanProductId] = 1
	)
)

the last problem I need is on the days where there's no loans for it to record as 0?

Hi @cgardyne,



the last problem I need is on the days where there's no loans for it to record as 0?

Could you try add '+ 0' after SUMX (Loans, Loans[Amount] + Loans[Fee]) to see if it works? Smiley Happy

Running Total Computers =
CALCULATE (
    SUMX ( Loans, Loans[Amount] + Loans[Fee] )
        + 0,
    FILTER (
        ALL ( Loans ),
        Loans[User Sign Up Date] >= MIN ( 'Calendar'[Date] )
            && Loans[User Sign Up Date] <= MAX ( 'Calendar'[Date] )
            && Loans[LoanProductId] = 1
    )
)

 

Regards

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.