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
shashankg
Frequent Visitor

How to get selected date range from relative date slicer

I have Relative date slicer and I want to pick exact date range which is selected in drop down.

Is it possible?
Example – Suppose slicer have following value – I want to get exact date range that is 11/18/2021 - 11/24/2021 and store in some variable

shashankg_0-1712227589194.png

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@shashankg Yes, as measures:

MinDate = MIN('Table'[Date])

MaxDate = MAX('Table'[Date])

 

Inside a measure:

VAR __MinDate = MIN('Table'[Date])

VAR __MaxDate = MAX('Table'[Date])


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
shashankg
Frequent Visitor

@Greg_Deckler Thanks for your reply,

MIN('Table'[Date]) and  MAX('Table'[Date]) gives values from the table. I don't want values from table. for eg, as shown in image,

I want

var 1 = "Last 1 weeks"

var2 =  11/18/2021

var3 = 11/24/2021

These values are coming from relative date slicer.

Hi @shashankg 

 

Unfortunately, Power bi doesn't support this feature currently, you can't get the value which doesn't exist in your table.

The slicer is just another way of filtering, which can only filter based on the values you already have.

Best Regards

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

 

Greg_Deckler
Super User
Super User

@shashankg Yes, as measures:

MinDate = MIN('Table'[Date])

MaxDate = MAX('Table'[Date])

 

Inside a measure:

VAR __MinDate = MIN('Table'[Date])

VAR __MaxDate = MAX('Table'[Date])


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.