Forum Discussion
To create a Date Slicer
- Anonymous3 years ago
Hi Anonymous ,
1. first use enter data to create a new table like:2. then please new a measure like:
Measure = VAR _SLICER = MAX('Table'[Slicer]) VAR _TODAY = TODAY() VAR _DATE = MAX('Calendar'[Date]) VAR _LAST_2_DAYS = TODAY() - 2 VAR _FIRSTDATEOFWEEK = TODAY() - WEEKDAY(TODAY(),2) VAR _MONTH = MONTH(_TODAY) VAR _YEAR = YEAR(_TODAY) VAR _FILTER = SWITCH( TRUE(), _SLICER = "Today"&&_DATE=_TODAY,1, _SLICER = "Last 2 days"&&_DATE>=_LAST_2_DAYS&&_DATE<_TODAY,1, _SLICER = "This week"&&_DATE>=_FIRSTDATEOFWEEK&&_DATE<_FIRSTDATEOFWEEK+7,1, _SLICER = "This month"&&_YEAR=YEAR(_DATE)&&_MONTH=MONTH(_DATE),1 ) RETURN _FILTER3. apply it to the filter:
Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
- Anonymous3 years ago
Hi Anonymous ,
Best Regards,
Gao
Community Support Team
amitchandak can you pls explain
and i even want to add custom date picker also
like and it should be in this order:
Today
Last 2 days
this week
this month and
custom(date picker)
when i clicked custom (date picker) it should display date picker
any idea?
and i even created a date picker but when i click year it doesn't show all the years
@WarrenBelz @iAm_ManCat Anonymous BI andres777
Hi Anonymous ,
1. first use enter data to create a new table like:
2. then please new a measure like:
Measure =
VAR _SLICER = MAX('Table'[Slicer])
VAR _TODAY = TODAY()
VAR _DATE = MAX('Calendar'[Date])
VAR _LAST_2_DAYS = TODAY() - 2
VAR _FIRSTDATEOFWEEK = TODAY() - WEEKDAY(TODAY(),2)
VAR _MONTH = MONTH(_TODAY)
VAR _YEAR = YEAR(_TODAY)
VAR _FILTER =
SWITCH(
TRUE(),
_SLICER = "Today"&&_DATE=_TODAY,1,
_SLICER = "Last 2 days"&&_DATE>=_LAST_2_DAYS&&_DATE<_TODAY,1,
_SLICER = "This week"&&_DATE>=_FIRSTDATEOFWEEK&&_DATE<_FIRSTDATEOFWEEK+7,1,
_SLICER = "This month"&&_YEAR=YEAR(_DATE)&&_MONTH=MONTH(_DATE),1
)
RETURN
_FILTER
3. apply it to the filter:
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
- Anonymous3 years agoNot applicable
Hi Anonymous I did the exact same thing but it didnt show in order
can you pls tell me where did i miss
- Anonymous3 years agoNot applicable
Hi Anonymous ,
Best Regards,
Gao
Community Support Team- Anonymous3 years agoNot applicable
Thank you so much Anonymous
and i would like include date picker also such as:
Today
Last 2 days
this week
this monthis working perfectly fine ...
is there anyway that we could include Custom(Date picker) in the same slicer ?
Thanks in Advance !!!
Anonymous @Eyelyn9 @BI @andres777