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
mo1988
Helper I
Helper I

Getting the last working day before today

Hi,

In my powerbi report, I am trying to flag as the latest working day as 1 and other days as 0.

Working Days are (Monday -> Friday)
Attached is a sample example of what I am trying to achieve.

mo1988_0-1680539899210.png

Please help - thanks.

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

Hi  @mo1988 ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _today=TODAY()
var _week=WEEKDAY(MAX('Date'[Date]),2)
return
MAXX(
    FILTER(ALL('Date'),
    'Date'[Date]<_today&&NOT( _week) in {6,7}),'Date'[Date])

2. Result:

vyangliumsft_0-1680747769203.png

 

Best Regards,

Liu Yang

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-yangliu-msft
Community Support
Community Support

Hi  @mo1988 ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _today=TODAY()
var _week=WEEKDAY(MAX('Date'[Date]),2)
return
MAXX(
    FILTER(ALL('Date'),
    'Date'[Date]<_today&&NOT( _week) in {6,7}),'Date'[Date])

2. Result:

vyangliumsft_0-1680747769203.png

 

Best Regards,

Liu Yang

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

@mo1988 ,

 

maxx(filter(allselected(Date), date[Date] < date[Date] && weeknum(Date[Date],2) <6) , Date[Date])

 

Also, check

Power BI Workday vs Last Workday- https://youtu.be/MkYLT_GYIbM

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

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.