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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kaileena
Frequent Visitor

dynamically set current date to slicer date selection

Hello, 

 

I have a slicer with Date column 

kaileena_2-1657637880128.pngkaileena_0-1657638692317.png

 

 

 

 

And I will show a snap shot of my calendar table from the query editor. I want the value of the "current date" to be what ever value i select from slicer. I want the current date to "read" what ever value i select from date slicer. Here is a snap shot from the query editor. I have copied the calendar table from another source, so i do not own it. 

kaileena_3-1657637520334.pngkaileena_4-1657637539711.png

regards,

kaileena

 

 

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @kaileena ,

 

Agree with @edhans that there is no way to pass the selection in slicer back to Power Query though.

 

 

You may create a measure to dynamically get the offset:

Offset = DATEDIFF(MAX('Table'[Date]),MAX('Dates'[Date]),MONTH)

Eyelyn9_0-1657852714987.png

 

Best Regards,
Eyelyn Qin
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

5 REPLIES 5
v-eqin-msft
Community Support
Community Support

Hi @kaileena ,

 

Agree with @edhans that there is no way to pass the selection in slicer back to Power Query though.

 

 

You may create a measure to dynamically get the offset:

Offset = DATEDIFF(MAX('Table'[Date]),MAX('Dates'[Date]),MONTH)

Eyelyn9_0-1657852714987.png

 

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

Hello! thank you. 

edhans
Super User
Super User

Unfortunately you cannot do this. The selected value(s) in a slicer are locked to what you had selected when you published and they cannot dynamically be changed via DAX.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Hello! I would like my query editor to "read" the value I selected in the slicer. (i need this because i have other columns that calculte the month offset. I want to calculate the month offset with respect to slicer selection)

 

I hope it is clearer. I will edit the text above.

Power Query cannot see anything in the DAX model nor in the report layer. In DAX, you can use SELECTEDVALUE() or ALLSELECTED() to see what the user has selected. There is no way to pass that back to Power Query though. Power Query to the Model is a one way street - Power Query loads data in.

An exception to that is with a direct query model, but that is only to allow PQ to create SQL code and cannot see the report layer. It just talks to the storage engine.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors
Top Kudoed Authors