Forum Discussion
Power BI YTD Sales Calculation Issue with Appended Data Sources
- 1 year ago
Hi it_kwwk
Thank you for reaching out to the Microsoft Fabric Community Forum.
To ensure accurate YTD calculations across all data sources regardless of date presence, implement a separate Date Table and use it to control the filters and time intelligence functions.
1. Create a calculated table with a full range of dates covering both sources:DateTable =
ADDCOLUMNS (
CALENDAR (DATE(2024, 1, 1), DATE(2025, 12, 31)),
"Year", YEAR([Date]),
"Month", FORMAT([Date], "MMMM"),
"MonthNumber", MONTH([Date]),
"YearMonth", FORMAT([Date], "YYYY-MM")
)
2. Mark as Date Table using the [Date] column.
3. Create Relationship between DateTable[Date] to AppendedTable[Date].
4. Update Slicers by using Year and Month from the Date Table, not from the appended data.
5. Create YTD Sales Measure by using the below DAX
CurrentYTD_Sales =
TOTALYTD(
SUM(AppendedSales[SalesAmount]),
DateTable[Date]
)
6. Use this measure in your matrix or visuals. It will now calculate YTD correctly, even when data is missing for a specific month in one source.
I have attached the PBIX file for you reference . Please go through it .
If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.
Additionally, thank you Ritaf1983 for your quick response.
Thank You
Hi it_kwwk
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.