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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
NewbieJono
Post Partisan
Post Partisan

default filter date, Switch statement

Hello i have the follwoing code to identify today.
 
Is Today = Switch(True(),
[Date] = Today(), "Today",
Format([Date], "DD/MM/YYYY"))
 
is there a method to identify last working day. i do have a "is holday" and "is weekday" which return 1,0.
 
e.g
 
IsHoliday =
IF ( 'DIM - Date Table'[Date] IN DISTINCT ('DIM - Holiday'[Holidays]), 1, 0 )
 
IsWorkingDay = IF (NOT('DIM - Date Table'[Day]= "Saturday" || ('DIM - Date Table'[Day]= "Sunday")),1,0)
 
Thanks all
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@NewbieJono , Try two columns like

 

WorkingDay = if(WEEKDAY([Date],2) >=6,0,1)

Is Today =
var _max = maxx(filter('Date', 'Date'[Date] <=today() && [WorkingDay] =1),'Date'[Date])
return
Switch(True(),
[Date] = _max, "Today",
Format([Date], "DD/MM/YYYY"))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
v-deddai1-msft
Community Support
Community Support

Hi @NewbieJono ,

 

Please try to change your isworkingday column to :

IsWorkingDay = IF ( WEEKDAY('DIM - Date Table'[Day],2)<6,1,0)

Then use the following column to determine the last working day:

lastworkingday = IF('DIM - Date Table'[Day] = CALCULATE(MAX('DIM - Date Table'[Day]),FILTER('DIM - Date Table','DIM - Date Table'[IsHoliday] = 1&&'DIM - Date Table'[IsWorkingDay] = 1&&'DIM - Date Table'[Day]<=Tody())),1,0)

 

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

 

Best Regards,

Dedmon Dai

amitchandak
Super User
Super User

@NewbieJono , Try two columns like

 

WorkingDay = if(WEEKDAY([Date],2) >=6,0,1)

Is Today =
var _max = maxx(filter('Date', 'Date'[Date] <=today() && [WorkingDay] =1),'Date'[Date])
return
Switch(True(),
[Date] = _max, "Today",
Format([Date], "DD/MM/YYYY"))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

is there anuthing i can do to show last working day,e.g not weekends

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.