Forum Discussion
AsNa_92
Resolver II
2 years agoCreate Period slicer based on Date
Hi Guys I have Date column and I want to create slicer with 1D/ 1W/ 1M/ 3M/ 6M and All. Can you please assist me on how to elaborate that?
- 2 years ago
Hi AsNa_92 - you can add a calculated column to your Date table that categorizes each date based on the defined periods (1D, 1W, 1M, 3M, 6M, and All).
Period =VAR CurrentDate = MAX('Datetable_W'[Date])RETURNSWITCH(TRUE(),'Datetable_W'[Date] >= CurrentDate - 1, "1D",'Datetable_W'[Date] >= CurrentDate - 7, "1W",'Datetable_W'[Date] >= EDATE(CurrentDate, -1), "1M",'Datetable_W'[Date] >= EDATE(CurrentDate, -3), "3M",'Datetable_W'[Date] >= EDATE(CurrentDate, -6), "6M","All")i have added the above column in my visual with slicer chart and it looks as expected from above snap
Hope this helps
rajendraongole1
Super User
2 years agoHi AsNa_92 - you can add a calculated column to your Date table that categorizes each date based on the defined periods (1D, 1W, 1M, 3M, 6M, and All).
Period =
VAR CurrentDate = MAX('Datetable_W'[Date])
RETURN
SWITCH(
TRUE(),
'Datetable_W'[Date] >= CurrentDate - 1, "1D",
'Datetable_W'[Date] >= CurrentDate - 7, "1W",
'Datetable_W'[Date] >= EDATE(CurrentDate, -1), "1M",
'Datetable_W'[Date] >= EDATE(CurrentDate, -3), "3M",
'Datetable_W'[Date] >= EDATE(CurrentDate, -6), "6M",
"All"
)
i have added the above column in my visual with slicer chart and it looks as expected from above snap
Hope this helps