Forum Discussion
Creating a Date Slicer with a Fixed Range
- 4 years ago
Anonymous , defaulting date range for last 30 in not possible.
You need to try an option like
Anonymous , defaulting date range for last 30 in not possible.
You need to try an option like
Thank you, amitchandak! Using "relative date" is definitely a step in the right direction, but I still need to use this based on a fixed date in the past.
Let me provide an example: I have different products, so I use a slicer to let users choose a specific product they want to analyse, for example product "X". In my data, I have the date when "X" went on sale and this should then be the basis for the analysis, e.g. even if I use "relative date" in my slicer, it should work based on the "on-sale date" of the chosen product.
Is there a different approach to achieve this or was this perhaps already in your suggested solution and I did not understand/apply it correctly?
- amitchandak4 years ago
Super User
Anonymous , Prefer to use an independent date table in the slicer
example based on what I got
measure =
var _max = maxx(filter(allselected(Table), Table[product] in selectedvalue(Product[poduct])), Table[Date])
var _min = _max -30
return
calculate(sum(Table[value]), filter('Table', Table[date] <=_max && Table[date] >=_min ))if product is from joined table or same table
measure =
var _max = maxx(filter(allselected(Table), Table[product] in selectedvalue(Product[poduct])), Table[Date])
var _min = _max -30
return
calculate(sum(Table[value]), filter(all('Table'), Table[date] <=_max && Table[date] >=_min ))- Anonymous4 years agoNot applicable
Thanks again, amitchandak. I have already used the method of creating an independent table, adding a measure and then generating a custom slicer for a different problem, so I know the general goal, but I am not able to wrap my head around the process in this case, since I am fairly new to Power BI. Do you perhaps have a link etc. for a step-by-step description?