cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Helper I

## Need help with running total

I am atemting to get a running total from the start of wnd of 2019 to the current date. Included is a picture of my dax code that is not currently working. Thanks!

1 ACCEPTED SOLUTION
Helper I

I was able to fix it by making a my own date table and using this code:

Total Revenue running total in Quarter =
CALCULATE(
SUM('Matt-DataForBI'[Total Revenue]),
FILTER(
ALLSELECTED('Date'[Quarter]),
ISONORAFTER('Date'[Quarter], MAX('Date'[Quarter]), DESC)
)
)
6 REPLIES 6
Super User

You need to add a Date table [Calendar Table] to your report.
To work with Data Analysis Expressions (DAX) time intelligence functions, there's a prerequisite model requirement: You must have at least one date table in your model.

https://www.vahiddm.com/post/creating-calendar-table-with-3-steps

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Super User

Does it help at all if you replace the ISONORAFTER line with the following?

``'Matt-DataForBI'[Date Closed] <= MAX ( 'Matt-DataForBI'[Date Closed] )``

Helper I

I tried that an unfortentetly it doesnt.

Super User

Hmm. What if you replace ALLSELECTED ( 'Matt-DataForBI'[Date Closed] ) with ALLSELECTED ( 'Matt-DataForBI' )?

Helper I

I was able to fix it by making a my own date table and using this code:

Total Revenue running total in Quarter =
CALCULATE(
SUM('Matt-DataForBI'[Total Revenue]),
FILTER(
ALLSELECTED('Date'[Quarter]),
ISONORAFTER('Date'[Quarter], MAX('Date'[Quarter]), DESC)
)
)
Super User

Great! Having a date dimension table is almost always a good idea.