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 nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hi Guys.
I have a sales table with product categories and a calendar table.
I use the below measures to calculate the Sales YTD and LYTD
Solved! Go to Solution.
Hi @kostask,
Mechanically, you achieve your objective by sumxing over the category field which you are bringing in your visualization rows, for row total to correctly add up with what's being shown in the visualization. If you have a saparate category dimension table with one to many relationship with your fact table 'Sales Table' and the category field from the dimension field is properly used in your visualization, the formula will be referencing that dimension table Category field instead.
A couple of observations:
Since you have properly created the calendar table for date dimension, what about writing the TotalYTD formula like below?
Also, the output produced in the above manner for omitting the previous year sales where there are no sales this year will generate rather misleading information (by omission), and the prior year sales total will not be consistent with the previously reported number.
If you want to exclude categories that have no sales this year in the mausure for the preceding year, that is not very hard to do, but you would need to give more info on your model, specifically if the categories are in a separate dimension, and if so, the columns involved in the relationship between that dimension and the sales fact table.
Hi @kostask,
Mechanically, you achieve your objective by sumxing over the category field which you are bringing in your visualization rows, for row total to correctly add up with what's being shown in the visualization. If you have a saparate category dimension table with one to many relationship with your fact table 'Sales Table' and the category field from the dimension field is properly used in your visualization, the formula will be referencing that dimension table Category field instead.
A couple of observations:
Since you have properly created the calendar table for date dimension, what about writing the TotalYTD formula like below?
Also, the output produced in the above manner for omitting the previous year sales where there are no sales this year will generate rather misleading information (by omission), and the prior year sales total will not be consistent with the previously reported number.
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 |