The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Dear Power BI community
For some reason I have a hard time creating a measure that calculates the running total by year of another measure after a given start year. Other post on running total have not helped me so far, so I hope you can give me some advice.
I have a calendar table and a data table. From these I have created a measure called [Change] which calculates the change in products stock (forecast) and therefore i first need a running total from this year and on. So in the table below i have showed the visual i have made based on this and added the measure [Running total of change] which is what i need help for:
What I have | What I have | What I need |
Year | Change | Running total of change |
2022 | 2 | |
2023 | 1 | |
2024 | 3 | 3 |
2025 | 1 | 4 |
2026 | 5 | 9 |
2027 | 2 | 11 |
Thank you in advance 🙂
Solved! Go to Solution.
Hi @Anonymous
You can try below measure.
Running total of change =
VAR StartYear_ = YEAR ( NOW () )
VAR CurRowYear = MAX ( 'Calendar'[Year] )
RETURN
SUMX (
FILTER (
ALL ( 'Calendar'[Year] ),
'Calendar'[Year] >= StartYear_
&& 'Calendar'[Year] <= CurRowYear
),
[Change]
)
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Hi @Anonymous
You can try below measure.
Running total of change =
VAR StartYear_ = YEAR ( NOW () )
VAR CurRowYear = MAX ( 'Calendar'[Year] )
RETURN
SUMX (
FILTER (
ALL ( 'Calendar'[Year] ),
'Calendar'[Year] >= StartYear_
&& 'Calendar'[Year] <= CurRowYear
),
[Change]
)
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Hi @Anonymous
Are you using a date table in your data model and it is marked as a date table? If you do, you can use the time intellignece DAX
Change Running Total =
TOTALYTD(SUM(Table[Change]), Date[Date])
Hope this hlps
Joe
Proud to be a Super User! | |
Date tables help! Learn more