Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Time Intelligence base on Slicer or Filter and can affect Date range slicer

I have a table call Item and has records as show below:

EalTim_0-1649140790862.png

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.

EalTim_1-1649140903834.png

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?

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Create a slicer table by "enter data".

Vlianlmsft_0-1649407226494.png

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))

Vlianlmsft_1-1649407271625.png

 


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Create a slicer table by "enter data".

Vlianlmsft_0-1649407226494.png

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))

Vlianlmsft_1-1649407271625.png

 


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@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

Anonymous
Not applicable

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.