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
Anonymous
Not applicable

Date Default selection till Yesterday

Hi Power Community,

 

I have a date filed in Fact table wihich continas data since 2005 till yesterday.

For filtering purpose I am using Date dimention which contians 2005 till 2025. here when ever user open report user should see data in current year till yersterday.

 

The Slicer also shoud show only the curreent year(till yesterday not entire year 01/01/2020 - 05/11/2020) as default selection.

 

PLease sugget me solution its a showstiopper for me since a two days.

 

Thanks.

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

Hi, @Anonymous 

According to your description, you want the data, and Slicer both show only the current year till yesterday. If you just want to show data from the current year till yesterday, you can try this measure:

Measure =

CALCULATE(MAX([Amount]),FILTER('Table',YEAR([Date])=YEAR(TODAY())&&[Date]<=TODAY()-1))

And place the measure to the chart, like this:

v-robertq-msft_0-1604909114487.png   v-robertq-msft_1-1604909114490.png

If you want to set default value for a Slicer, I think that you can try the Power Slicer . It’s a custom visual which supports adding default value to Slicer using JavaScript. You can download it and try to figure out how to realize it.

 

Best Regards,

Community Support Team _Robert 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

2 REPLIES 2
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, you want the data, and Slicer both show only the current year till yesterday. If you just want to show data from the current year till yesterday, you can try this measure:

Measure =

CALCULATE(MAX([Amount]),FILTER('Table',YEAR([Date])=YEAR(TODAY())&&[Date]<=TODAY()-1))

And place the measure to the chart, like this:

v-robertq-msft_0-1604909114487.png   v-robertq-msft_1-1604909114490.png

If you want to set default value for a Slicer, I think that you can try the Power Slicer . It’s a custom visual which supports adding default value to Slicer using JavaScript. You can download it and try to figure out how to realize it.

 

Best Regards,

Community Support Team _Robert Qin

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 , There is workaround .

Create a column like this and sort it on date and save it on yesterday

New column in date table

Date Type = SWITCH(TRUE(),'Date'[Date]=TODAY(),"Today",'Date'[Date]=TODAY()-1,"Yesterday",'Date'[Date]&"")

 

It has all dates with yesterday and today and sorted on the date to will behave the same. You can use format on date, if needed

 

Refer my video for steps: https://www.youtube.com/watch?v=hfn05preQYA

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

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.