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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
nbarjesteh
Helper I
Helper I

Working day table (that updates without visual relative date filter)

Hi!  I have a table that shows the details of Run Time by Machine (No_) for the previous day.  I am using a visual date filter to capture the previous day information.  The problem is that not everyday is a working day and I would love it if I didn't have to keep changing the filter every Monday or after every holiday.  Any thoughts?  I have attached a link to my pbix file.  See "Run Time by No_ (Last Working Day) visual.

 

Link 

 

Thanks!

@v-janeyg-msft 

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @nbarjesteh ,

It's not very clear which fields you want in your PBIX file.... If you want to find which are working days, you can find out the holiday table in your area and import it into Power BI Desktop to mark which are off days and which are working day

I created some data:

2022 Holiday:

vyangliumsft_0-1645425844843.png

Calendar table:

Calendar table =

CALENDAR(DATE(2022,1,1),DATE(2022,12,31))

vyangliumsft_1-1645425844845.png

Information:

vyangliumsft_2-1645425844848.png

Here are the steps you can follow:

1. Create calculated column.

IsHoliday =
IF(
    ISBLANK(RELATED('2022 Holiday'[Date]))=FALSE(),
    1,0)

Week = WEEKDAY('Calendar table'[Date],2)
Flag1 =
IF(
    'Calendar table'[IsHoliday]=1||'Calendar table'[Week] in {6,7},1,0)
Index =
RANKX(FILTER('Calendar table',[Flag]=0),[Date],,ASC,Dense)
closest to today =
var _todayIndex=CALCULATE(MAX('Calendar table'[Index]),FILTER(ALL('Calendar table'),'Calendar table'[Date]=TODAY()))
return
CALCULATE(MAX('Calendar table'[Date]),FILTER(ALL('Calendar table'),[Index]<_todayIndex))

vyangliumsft_3-1645425844849.png

2. Create measure.

Flag =
IF(
    MAX('information'[Date])=MAX('Calendar table'[closest to today]),1,0)

3. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_4-1645425844849.png

4. Result:

vyangliumsft_5-1645425844853.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

Hi @v-yangliu-msft - Thanks for your response!  Let me see if I can be a little more clear with my desired output.  I came in this moring (Monday) and the table did not show anything, because I have the page filter set to look at a relative date (is in the last: 1 days) and we do not work on the weekends.

nbarjesteh_0-1645456897286.png

So, I had to change my page filter to "(is in the last: 3 days) to capture last Friday (our last working day).

nbarjesteh_1-1645456992665.png

My goal is to have this table show up automatically and not have to update a page date filter.   I have attached the latest pbix here:File Link 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.