Forum Discussion
12 Months Trailing graph using custom Calendar
I'm LandCrab's work colleague, and coded the queries involved here.
The Calendar is queried directly from the ERP, which has a Calendar table with FY, Period, start and end dates. The query cross-applies a Tally table to fill in all dates between Start and End of each period via DateAdd's, and then generates start-end date pairs for all combinations needed, for every date. Summary expressions in DAX use a standard form of expression based on choices from the wide selection of start-end dates. [YTD Actual] expression is an example.
All this is necessary because the calendar is essentially weekly, although not for all financial years, and inbuilt PowerBI expressions like TOTALYTD simply don't work across all FY's.
So there is no DAX 'calendar generation script': the query is packaged as a View in the originating ERP company, and results in a Table within the model.