The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I am trying to build a running total for CY and PY for the month like the graph below.
I would also like budget and forecast to be reference lines on the top.
Solved! Go to Solution.
solved it with your help and added a filter for current year. Then the following measures
solved it with your help and added a filter for current year. Then the following measures
Hi @Lewdis_ ,
As Kedar_Pande said, you can do this by adding a constant line for the y-axis in the analysis window. Here is the example data
Date | CY Sales | PY Sales | CY Budget |
1/1/2024 | 1000 | 2000 | 1000 |
2/1/2024 | 2000 | 4000 | 2000 |
3/1/2024 | 2500 | 5000 | 3000 |
4/1/2024 | 4500 | 4000 | 4000 |
5/1/2024 | 3000 | 1000 | 5000 |
6/1/2024 | 2000 | 2000 | 6000 |
7/1/2024 | 1000 | 3000 | 7000 |
8/1/2024 | 2000 | 2000 | 8000 |
9/1/2024 | 6000 | 1000 | 9000 |
10/1/2024 | 4000 | 4000 | 10000 |
11/1/2024 | 1200 | 3000 | 11000 |
12/1/2024 | 3500 | 1500 | 12000 |
Create columns
Running Total of PY Sales =
VAR _currentDate = 'Table'[Date]
RETURN
SUMX(
FILTER(
'Table',
'Table'[Date] <= _currentDate
),
'Table'[PY Sales]
)
Running Total of CY Sales =
VAR _currentDate = 'Table'[Date]
RETURN
SUMX(
FILTER(
'Table',
'Table'[Date] <= _currentDate
),
'Table'[CY Sales]
)
Running Total of CY Budget =
VAR _currentDate = 'Table'[Date]
RETURN
SUMX(
FILTER(
'Table',
'Table'[Date] <= _currentDate
),
'Table'[CY Budget]
)
Create measure
Sum of budget = SUM('Table'[CY Budget])
Create line chart and constant line
Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
I have tried to use a field for running total and it works fine in the last graph where I use a date field
But if I want to show both CY and PY next to each other using Year-Month field it doesnt work
Create measures for: CY Running Total, PY Running Total, Budget, Forecast.
Select a Line Chart and add your Date field to the Axis.
Add CY Running Total and PY Running Total to the Values.
In the Analytics pane, add Constant Lines for both Budget and Forecast.
If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
I have a measure for YTD running total in general
Hi @Lewdis_,
Could you provide more information on the challenge you're facing?
You can simply use a line chart.
If this helped, a Kudos 👍 or Solution mark would be great! 🎉
I have started with a line chart showing CY, PY and Budget sales per month. But I dont know how to change them to be running.
Second is that i want the budget to be a total reference line on the top instead.