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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Rahulsingh
Helper I
Helper I

How to get value from date slicer

Hi Everyone, 

 

I am trying to get the date out of this slicer to use it in a formula.  How can I get 3/31/2018 from a slicer in order to pass it to the calculated column?

Any help would be greatly appreciated

Any help would be greatly appreciated Slicer.JPG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Rahulsingh,

 

Use this formula: 

 

Date_Selected = CALCULATE(MAX(Date_Table[DateRec]);ALLSELECTED(Date_Table))

 

Regards.

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Hi @Rahulsingh,

 

Use this formula: 

 

Date_Selected = CALCULATE(MAX(Date_Table[DateRec]);ALLSELECTED(Date_Table))

 

Regards.

Hi There,
I have written the same formula to get the min & max value from the date slicer but for some reason it's not working for me.

Here is the formula to get slicer start & end date

startDate = CALCULATE(MIN('CASE_DEFLECTION_ANALYSIS'[SYS_CREATED_ON].[Date]), ALLSELECTED('CASE_DEFLECTION_ANALYSIS'))

endDate = CALCULATE(MAX(CASE_DEFLECTION_ANALYSIS[SYS_CREATED_ON].[Date]), ALLSELECTED(CASE_DEFLECTION_ANALYSIS))


Is there something I need to do in the desktop settings? 

Try Removing .[Date] and it should work.
Updated DAX

 

startDate = CALCULATE(MIN('CASE_DEFLECTION_ANALYSIS'[SYS_CREATED_ON]), ALLSELECTED('CASE_DEFLECTION_ANALYSIS'))

endDate = CALCULATE(MAX(CASE_DEFLECTION_ANALYSIS[SYS_CREATED_ON]), ALLSELECTED(CASE_DEFLECTION_ANALYSIS))


 

Please give a Thumbs-up if it worked

Anonymous
Not applicable


@Anonymous wrote:

Hi @Rahulsingh,

 

Use this formula: 

 

Date_Selected = CALCULATE(MAX(Date_Table[DateRec]);ALLSELECTED(Date_Table))

 

Regards.


This is pretty close but doesn't completely work.

Example: If you have a from and through date of 10/1/2018 to 12/31/2018 but you only have data that goes up to 12/15/2018, this will result in the max date being 12/15/2018 not 12/31/2018. If you wanted to use 12/31/2018 in a calcluation you couldn't.

Is there any way to just grab the date a user enters and use that date in another calculation, regardless of the data set that is returned?

Hi,

Assuming the Date slicer is built from a Calendar Table, try this measure

=Max(Calendar[Date])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you @Ashish_Mathur ! It worked well.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Super User
Super User

Perhaps something like:

 

MyDate = MAX(Table[DateRec])


Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

hi Greg, 

 

I have used this logic but it gives me the max date of that column which is 5/7/2018 and completely ignores the selection. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.