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

automatically yesterday selection

i have data field .. i drag that field in dropdown box .. so i want automtically selection on yesterday dates

 

means if today is march 5, 2020 .. then i want march 4, 2020 selection when ever i open the report'

if tommorrow is march 6, 2020 then date om dropdown should be  march 5,2020

 

any help

 

yet i did not try anything

9 REPLIES 9
v-alq-msft
Community Support
Community Support

Hi, @Bakhtawar 

 

Based on your description, I created data to reproduce your scenario.

 

DateTable = CALENDAR(DATE(2020,1,1),DATE(2020,6,30))

 

 

You may create two measures as follows.

 

IsYesterday = 
IF(
    TODAY()-1 = MAX(DateTable[Date]),
    1,0
)

IsTomorrow = 
IF(
    TODAY()+1 = MAX(DateTable[Date]),
    1,0
)

 

 

Then you can create two slicers with Date column and put the measure to the corresponding visual level filter of the visual. Today is 3/6/2020. Here is the result.

b1.png

b3.png

 

 

Best Regards

Allan

 

 

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

i tried your solution and it worked @v-alq-msft  but i want to displayed date instead of ALL text ? is this possible .. like now ALL is dsiplayed when i opened report.. but i want to displayed date instead of ALL

 

Hi, @Bakhtawar 

 

You need to click the icon because the slicer is dropdown type.

e1.PNG

e2.PNG

 

For convenience, you may change it to 'list'.

e3.png

 

Best Regards

Allan

 

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

i know.. but i dont want this "ALL" text.. i want to just display date instead of ALL text.. means no need for selection/click

@v-alq-msft 

Hi, @Bakhtawar 

 

Based on my tests, I think it is unsupported to select a value in a slicer automatically by default. The selectable value of a slicer changes with the context, but the selected value cannot be changed automatically. So you can see yesterday is selectable. However it can't be selected automatically.

 

Best Regards

Allan

 

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

ok is this possible to display other dates with highlight of yesterday date in dropdown .. it seems like only yesterday date is displayed.. if we want to display other date with highlight of yesterday date ? then is this possible.. however your solution is worked for display date @v-alq-msft 

amitchandak
Super User
Super User

In case you want only one measure do it like

Yesterday = CALCULATE(SUM(Sales[Sales Amount]),'Date'[Date] =Today()-1)

 

For everything, use relative date slicer

https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

 

Appreciate your Kudos.

Greg_Deckler
Super User
Super User

See if this thread helps:
https://community.powerbi.com/t5/Desktop/Setting-the-Default-Value-of-a-Slicer/td-p/16442

@ 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
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.