I'm developing an app which generates graphs from data in an excel document each month. Instead of having the end-user change the date format in the source document each month, I created a field in the app which interprets and converts the date format into a date field (See below code).
One of the graphs displays the amount of charges (Measure) each month (Dimension). However, the graph shows 8 months and the user has requested the graph to show the last 6 months. How do I make the graph (1) display the last 6 months and (2) make the expression dynamic so it automatically displays the last 6 months when I upload new data each month?
LOAD Date(Date#(Date, 'YYYY/MMM'),'MM/YYYY') as Date, Charges
(ooxml, embedded labels, table is Sheet1);
Load max(Date) as max Resident FactTable;
=If(Date > Date(MonthStart(Date(max,'YYYY/MM'), -6),'YYYY/MM') and Date <= Date(max,'YYYY/MM'), Date)