Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hello,
I'm following Power BI tuto and good news, I'm already stuck at the TOTALYTD DAX function.
Here is an extract of the test table (Excel) I created (and I generated around 700 lines):
Sales | Date | MonthNumber | Year |
4 | 01/01/2016 | 1 | 2016 |
6 | 02/01/2016 | 1 | 2016 |
8 | 03/01/2016 | 1 | 2016 |
38 | 04/01/2016 | 1 | 2016 |
54 | 05/01/2016 | 1 | 2016 |
2 | 06/01/2016 | 1 | 2016 |
5 | 07/01/2016 | 1 | 2016 |
23 | 08/01/2016 | 1 | 2016 |
24 | 09/01/2016 | 1 | 2016 |
I'd like to have a cumulative view of the sales by month for each year so I created this variable:
YTD = TOTALYTD(SUM(Sheet1[Sales]);Sheet1[Date])
When I create a matrix with MonthNumbers as rows, Years as columns and YTD as values (right matrix), I get the same as when I create a matrix with MonthNumbers as rows, Years as columns and Sales as values (right matrix).
Does someone have an idea?
Thanks a lot!
Solved! Go to Solution.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsRegards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @MFelix,
Thank you for your solution!
By creating a seperate calendar table and linking the 2 tables, my measures perfectly works.
Regards,
thimremy
Hi @thimremy
I dont get your point , u need to calculate cumulative sum of sales by month ?
if u neeed to calculate sum of sale group by month
measure= calculate(sum(sheet1[sales]); DATESMTD(Sheet1[Date])
Let me know your need exactly
Hi @Mariam1991,
Yes, I need to calculate a cumulative sum of sales througout the months (For example: for February 2017, I need to sum sales of January & February 2017).
As you said, to calculate sum of sales group by month, the following measure you offered perfectly works:
measure= calculate(sum(sheet1[sales]); DATESMTD(Sheet1[Date])
And to calculate a cumulative sum of sales througout the months, I tried @MFelix's solution to create a separate calendar table and I used my initial measure (YTD = TOTALYTD(SUM(Sales[Sales]);Date[Date])) and it perfectly worked.
Thank you for having answered so quickly!
Regards,
thimremy
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 29 | |
| 27 | |
| 25 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 54 | |
| 46 | |
| 38 | |
| 28 | |
| 21 |