Forum Discussion
Last period Data based on Date/Quarter/Month/Week Filter selection
- 8 years ago
Its all about filter context, Try creating a lookupdate table with Just YEARMONTHSHORT values
YEARMONTHS = VALUES(date[YearMonthShort])
Relate that to your data table and set your slice on that.
If doesn't work, you could try NOT using a SLICER to select the month but instead use a disconnected slicer to have user select month, date or whatever and then use that SELECTEDVALUE of what the user selectes as teh desired period in your measures.
Hi Seward12533,
Thank you so much for the reply. That would work. But I have one question, If user selects any of this slicer, Lets say user selects Month, then he should allow to select only 'Month filter' or if he selects Week, then he should see Week filter. Is it possible?
Because based on the selection, they want to see past period data. If user selects 'Feb 2018', he wants to see data from Feb -2017 to Feb 2018. (Last 12 months based on selection)
Regards,
Poonam
You would ahve to give me a better idea of what your data model and visuals look like.
If you just want to limit the data range based on the choice and then use other filters to further refine its a bit more complicated. In this case you don't want to put the logic into the measures but rather use Time Intelligence and dyanmic filter context of Power BI. The approach woudl be to write a meausure to calculate the EARLIEST_DATE and LATEST_DATE based on today's date (or selected daate) and the choice form the disconnected slicer. Then add a calcualted column to your date table called "Include" or something like that and test to see if the date on each row of the date table is in that range or not. Then use a Page filter to only include Include="YES". This will imit the scope of all the calcualtions to within the date range you calculate.
Hoep this helps.