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

Measure of date for a day before [Weekends Excluded]

Hello all,

 

I have a simple DAX column that should adjust the date when data is written.

date_adjustment = FORMAT(table_name[Created],"dd.mm"
Since I am writing data today for day before I tried to get the date by adding
date_adjustment = FORMAT(table_name[Created],"dd.mm" - 1
Problem with this is the data written on monday, will show the date of Sunday instead of Friday.
For example 01/16/2023 was Monday and this data is for Friday 01/13/2023 and not Sunday 01/15/2023.
 
How can I make it always ignoring weekends and all data from last Monday to be asigned to last Friday?
 
Thanks
2 REPLIES 2
FreemanZ
Super User
Super User

hi @Nishlija995 

try to write the column like:

 

date_adjustment =
VAR _date = [Created]
RETURN 
MAXX(
    FILTER(
        table_name,
        table_name[Created] <_date
            && NOT WEEKDAY(table_name[Created]) IN {1,7}
    ),
    table_name[Created]
)

 

Hello @FreemanZ , thanks for fast response.

Unfortunatly this is not something I was looking for. Here is the screenshot.

image.png

 

This is the difference, on the right side is your formula. I need for all values to slip one day before. So 16th should be empty and this data should be written to 13th, 13th should go to 12th, 12th to 11th, etc. And also, weekends should not be visible in chart since they are empty.

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.