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
vafowler
New Member

Date defaults

Good Morning,

 

I want to set a default date for my dashboard. I also want to create a weekend button or slicer if possible. The dashboard this will be used on refreshes daily.Here is my current set up. When I refresh the data tomorrow and subscribers open the report it will still be defaulted to this. What can I do to have it automatically default to the previous day? 

vafowler_0-1724857584300.png

 

The second part of my question involves a weekend filter. On Monday, I want the default to show the previous 3 days (Friday, Saturday, and Sunday). 

vafowler_1-1724857780990.png

 Below is my current Calendar Table script

Calendar =
VAR CalTable = CALENDAR(DATE(2023,1,1), DATE(2024, 12, 31))
VAR MyCal =
    ADDCOLUMNS(
        CalTable,
        "Index", MONTH([Date]),
        "Month", FORMAT([Date], "mmm"),
        "Year", FORMAT([Date], "yyyy"),
        "Week", WEEKNUM([Date], 2),
        "DayName", FORMAT([Date], "ddd"),
        "Day", FORMAT([Date], "d"),
        "DayNo", WEEKDAY([Date], 2)
    )
    RETURN
        MyCal

I have tried looking at previous answers but none of them work for me. An example of a previous is the link below. I am unable to use the Date Picker. As for the other defauly options under General, I don't have those as options. 

https://community.fabric.microsoft.com/t5/Desktop/How-to-set-default-MAX-date-in-Slicer/m-p/3430227#...

 

Any and all help is greatly appreciated

1 ACCEPTED SOLUTION
shafiz_p
Resident Rockstar
Resident Rockstar

Hi @vafowler  If you want your dashboard automatically default to previous day, you can check my earlier solution here:

Select Slicer default yesterday with all dates showing 

 

You can use the same concept to tag the previous 3 days for your second part solution. Only changes would be, instead of single select it would be multiselect. Select previous 3 days using control button.

M code to identify Yesterday, Day before Last, or whatever you want, use the below code in power query.

Custom date =
if [Date] = Date.From(Date.AddDays(DateTime.LocalNow(), -1)) then "Yesterday" else if [Date] = Date.From(Date.AddDays(DateTime.LocalNow(), -3)) then "Day Before Last" else [Date]

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution, and a thumps up!!

Best Regards,
Shahariar Hafiz

View solution in original post

4 REPLIES 4
vafowler
New Member

Thank you. I wound up creating a calculated column using binary to determine previous day, which worked. I am still trying to figure out the weekend part. The trouble is I need both of them on the same page. The previous day filter how I did it works great- except until next Monday comes around and I need to show 3 days. Is there a way to default to the weekend but only if the current day is Monday else prev day?

 

I will take a lot at the link you provided.

I did not get what you want actually. Is that what you want, if today is monday, then it will show previous 3 days and if not monday then it will show previous day.

This is on / off situation. How do you implement such scenario. As far as I understand, that slicer default must always be on.

If this is your case, then 1 day in a week it will be 3 selected day, and all the other day it will be single selected.

I don't think I am explaining it very well. I will try your solution you provided and remove what I did since it doesn't seem to be working anyway. Thanks again.

shafiz_p
Resident Rockstar
Resident Rockstar

Hi @vafowler  If you want your dashboard automatically default to previous day, you can check my earlier solution here:

Select Slicer default yesterday with all dates showing 

 

You can use the same concept to tag the previous 3 days for your second part solution. Only changes would be, instead of single select it would be multiselect. Select previous 3 days using control button.

M code to identify Yesterday, Day before Last, or whatever you want, use the below code in power query.

Custom date =
if [Date] = Date.From(Date.AddDays(DateTime.LocalNow(), -1)) then "Yesterday" else if [Date] = Date.From(Date.AddDays(DateTime.LocalNow(), -3)) then "Day Before Last" else [Date]

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution, and a thumps up!!

Best Regards,
Shahariar Hafiz

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.