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
dw700d
Post Patron
Post Patron

automatically select latest date in slicer when value is not 0

Good day all,

 

I would like to have a slicer that  automatically selects the most recent date in my data set. For instance in the visual below the slicer should automatically select 12/31/22 since this is the most recent date. Once 1/31/23 is added the slicer should automatically select 1/31/23. What kind of measure can I create to accomplish this?

 

There is additional criteria that would be helpful if possible but if too complicated I don’t need to have. As you can see in the visual below 12/31/22 has a 0 entry. This means the data for 12/31/22 has not been loaded yet. I would like to have a slicer that automatically selects the latest date in my data set with a value other than 0. For instance in the visual below the slicer should automatically select 9/30/22 since 12/31/22 has a value of 0. Once 12/31/22 has a value other than 0 then the slicer will select 12/31/22. What kind of measure can I create to accomplish this?

 

 

dw700d_0-1668261510229.png

 

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

Hi @dw700d ,

 

Create a measure like below:

Measure = 
var maxnot0 = CALCULATE(MAX('Table'[date]),FILTER(ALLSELECTED('Table'),'Table'[value]<>0))
return
IF(SELECTEDVALUE('Table'[date])=maxnot0,1,0)

Add it to visual filter and set value = 1.

vjaywmsft_0-1669962676791.png

Please note that the slicer cannot be automatically selected at any time.

This method only makes the slicer to display the most recent date that is not 0.

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @dw700d ,

 

Create a measure like below:

Measure = 
var maxnot0 = CALCULATE(MAX('Table'[date]),FILTER(ALLSELECTED('Table'),'Table'[value]<>0))
return
IF(SELECTEDVALUE('Table'[date])=maxnot0,1,0)

Add it to visual filter and set value = 1.

vjaywmsft_0-1669962676791.png

Please note that the slicer cannot be automatically selected at any time.

This method only makes the slicer to display the most recent date that is not 0.

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
timg
Solution Sage
Solution Sage

Hi,

You could create a calculated column in which you replace the date with either  "Today" or "Other" based on the day it is (you can use TODAY() for this). If you then use this column as a slicer you can always filter your results based on the current day. Below I placed an example:

image.PNG

Hope that helps!

Regards,

 

Tim





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi

 

Use the sorted option wusing the 3 dots and choose sort descending

JamesFr06_0-1668265069701.png

 

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!

November Carousel

Fabric Community Update - November 2024

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

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.