Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi
Relatively new Power BI user.
I have some monthly sales data. For example:
Year Month £
2023 Nov 100
2023 Dec 150
2024 Jan 500
2024 Feb 350
2024 Mar 175
2024 Apr 400
I would like to create a line chart with cumulative sales (YTD) sales. So for 2024 - Jan YTD 500, Feb YTD 850, MAr YTD 1025, Apr YTD 1425.
Any advice on how I can do this would be appreciated.
Thank you
Your solutions is great @DataNinja777 and @wini_R
Hi, @Jon789
Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
Hi @Jon789,
Please check this formula for a YTD total:
CALCULATE(
SUM([Sales column]),
WINDOW(
1, ABS,
0, REL,
ORDER BY(
[Year], ASC,
[Month], ASC
),
PARTITION BY([Year])
)
)
For more details and examples please see this video: https://youtu.be/bxSWQNSQ8rQ?si=nsynUJ7erjFdXAXt&t=2058
Hi @Jon789 ,
You can create YTD calculation using standard dax time intelligence functions, and one of them is TotalYTD as shown below:
In order to take advantage of the time intelligence functions, you need to create a separate calendar table and create a relationship between your fact table and the calendar dimension table as show below:
I attach an example pbix file.
User | Count |
---|---|
93 | |
85 | |
77 | |
68 | |
62 |
User | Count |
---|---|
112 | |
97 | |
95 | |
64 | |
58 |