- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Running total up to certain month
Hi,
Currently I have a column labled date that has all the dates from 2010 to 2030.
I have another columns with lengths for each of these dates.
I would like to get a running count of the length for up to the dates in 2014, and then every year after that up to the current year we are in I want to add 10.
This will be a line that gradually goes up in my chart.
Right now I have,
CALCULATE(SUM(table[goal])/5280,
Filter(AllSelected(table),YEAR(table[Date]) <= 2014, table[Date before prev month] <> BLANK()
) + (YEAR(TODAY()) - 2014) * 11
but this does not give me a line that gradually goes up.
Can someone point me in the right direction?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @rchicas3 ,
To get a running count of the length for up to the dates in 2014, and then every year after that up to the current year we are in I want to add 10, you can use the following DAX formula:
Running Total =
VAR BaseYear = 2014
VAR CurrentYear = YEAR(TODAY())
VAR RunningTotal =
CALCULATE(
SUM(table[Length]),
FILTER(
ALL(table),
YEAR(table[Date]) <= BaseYear
|| YEAR(table[Date]) <= CurrentYear
&& YEAR(table[Date]) > BaseYear
)
)
RETURN
RunningTotal + (YEAR(TODAY()) - BaseYear) * 10
This formula first defines two variables, BaseYear and CurrentYear, which represent the years that define the start and end of the running total. The formula then calculates the running total by summing the lengths of all rows where the year is less than or equal to BaseYear, or where the year is less than or equal to CurrentYear and greater than BaseYear. Finally, the formula adds the difference between the current year and BaseYear multiplied by 10 to the running total.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
07-23-2024 01:29 PM | |||
03-21-2024 09:22 AM | |||
02-16-2024 05:18 AM | |||
10-15-2024 11:40 PM | |||
10-05-2024 12:49 AM |