Forum Discussion
Dynamic List by Date range
- Anonymous7 years ago
AlB
Thank you for the solution. However it didn't work for me right away,but put me on the right path.
So what I had to do to fix this was using a measure as a filter like you did.RollingYearList = VAR RollingMonths = 36 VAR DataTableDate = MIN(DataTable[Date]) VAR DateTableDate = EDATE(MIN(FilterTime[Date]); 11) VAR DateAddAlternative = EDATE(DateTableDate;-RollingMonths) RETURN IF( (DataTableDate < DateTableDate) && (DataTableDate > DateAddAlternative) ; -- FLAG -- 1 )This article by Radacad describes the measure in more detail: http://radacad.com/dynamic-date-range-from-slicer
I had to deactivate the relationship of my date table and data table, and create a new date table (FilterTime) which I used to filter my data table. That new date table is only connected to my original date table, so that I can filter it thorughout my report.
If I want to do any other calculations I just use the USERELATIONSHIP statement to connect the two tables for the measures where it is required.
Then I created a matrix in which I put my Category Values and Date Values of my data table in the "Rows" section (leaving all other inputs blank) and put the measure (RollingYearList) as a Visual Filter with "is 1". When just using a regular table, not adding the date values and applying this filter I would get incorrect results for some reason. That way I always get the categories that are in the three year date range of the particular month that I selected. Users can then perform a drill down where they can see in which months my categroies showed up. I didn't want this so I put a transparent rectangle of my matrix.
Have a nice weekend :),
Chris
See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008
- Anonymous7 years agoNot applicable
Hi Greg_Deckler,
thanks for the nice pbix sample file. Initially I was running into issues with my date calculations because of the date granularity. When calculating the number of Categories, it seems to work fine. But once I try to create a list of the categories it doesn't work.