Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have a table call Item and has records as show below:
I want to be able to create filter or Slicer that will have 1 Week, 2 Weeks and 1 Month based on DueDate and today's date and can change date range Slicer when selected.
Hence, when 1 week is selected, it will filter through to ItemName from today'date to next 1 Week of dueDate 12/04/2022
When 2 week is selected, it will filter through to ItemName today's date to the next 2 weeks of dueDate DueDate 19/04/2022
And finally, if 1 month is selected, it will filter through to ItemName next 1 month from today's date to DueDate 03/05/2022
How can i achieve this?
Solved! Go to Solution.
Hi @Anonymous ,
Create a slicer table by "enter data".
Create a measure and apply it to visual level filter:
Measure 2 =
var selection_ = SELECTEDVALUE('Table (2)'[Slicer])
return
SWITCH(TRUE(),
selection_ = "1 Week",IF(MAX('Table'[date])>=TODAY()&&MAX('Table'[date])<=TODAY()+7,1),
selection_ = "2 Weeks",IF(MAX('Table'[date])>=TODAY()&&MAX('Table'[date])<=TODAY()+14,1),
selection_ = "1 Month",IF(MAX('Table'[date])>=TODAY()&&MAX('Table'[date])<=TODAY()+30,1))
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Create a slicer table by "enter data".
Create a measure and apply it to visual level filter:
Measure 2 =
var selection_ = SELECTEDVALUE('Table (2)'[Slicer])
return
SWITCH(TRUE(),
selection_ = "1 Week",IF(MAX('Table'[date])>=TODAY()&&MAX('Table'[date])<=TODAY()+7,1),
selection_ = "2 Weeks",IF(MAX('Table'[date])>=TODAY()&&MAX('Table'[date])<=TODAY()+14,1),
selection_ = "1 Month",IF(MAX('Table'[date])>=TODAY()&&MAX('Table'[date])<=TODAY()+30,1))
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , You need swap there measure based on selection. refer measure slicer link below
This month Today =
var _min = eomonth(today(),-1)+1
var _max = eomonth(today(),0) //today()
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >= _min && 'Date'[Date] <=_max ) )
Last month Today =
var _min = eomonth(today(),-2)+1
var _max = eomonth(today(),-1) //today()
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >= _min && 'Date'[Date] <=_max ) )
This Week today =
var _st = today() +-1*WEEKDAY(today(),2)+1
var _end =today()+ 7-1*WEEKDAY(today(),2)
return
CALCULATE(SUM(Sales[Sales Amount]),filter('Date','Date'[Date]>= _st && 'Date'[Date]<=_end )) //use all('Date') if need in filter
Last Week today =
var _st = today() +-1*WEEKDAY(today(),2)+1 -7
var _end =today()+ 7-1*WEEKDAY(today(),2) -7
return
CALCULATE(SUM(Sales[Sales Amount]),filter('Date','Date'[Date]>= _st && 'Date'[Date]<=_end )) //use all('Date') if need in filter
This Week today last 7 days =
var _st = today() -7
var _end =today()
return
CALCULATE(SUM(Sales[Sales Amount]),filter('Date','Date'[Date]>= _st && 'Date'[Date]<=_end )) //use all('Date') if need in filter
2 Weeks today last 14 days =
var _st = today() -14
var _end =today()
return
CALCULATE(SUM(Sales[Sales Amount]),filter('Date','Date'[Date]>= _st && 'Date'[Date]<=_end )) //use all('Date') if need in filter
All About Time Intelligence around Today: https://youtu.be/gcLhhxhXKEI
Measure Slicer: https://www.youtube.com/watch?v=JLkKTJrdv04&list=PLPaNVDMhUXGYzjFASXjdY7GNoFxvlkR54&index=19
Calculation Groups- Measure Slicer, Measure Header Grouping, Measure to dimension conversion. Complex Table display : https://youtu.be/qMNv67P8Go0
Hi @amitchandak - don't really understand what you mean by swap measure based on selection refer measure slicer. This did not work for me.
I have updated my question. 1 week is from today's date to next 1 week,
2 weeks is from today's date to next 2 weeks,
and 1 month is from today's date to next 1 month