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
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.