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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Migang
Frequent Visitor

"How to Automatically Update Data with DAX Excluding Weekends"

Hi, I am new to the community, and I am learning to use Power BI.
I want to create a report where the data is automatically updated with the previous day's data. In other words, if it is Tuesday, it will update with Monday's data. However, the problem is that Saturdays and Sundays are not valid, so Monday's data needs to be updated with Friday's data. I have it done statically, but I would like to know if it can be done with DAX.

Migang_0-1720592283047.png

 

1 ACCEPTED SOLUTION

@Migang 

maybe you can try to create a flag column in date table 

 

Column =
var _last=maxx(FILTER('Table','Table'[date]<today()&&'Table'[Type]="L"),'Table'[date])
return if ('Table'[date]<=_last,"y")
 
11.PNG
 
and add this new column to filter and set the value to "y"




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@Migang 

do you only want to update and display the last workday's data or update and include until last workday's data?

 

could you pls provide some sample data?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Sorry for my English.
I want to update and display until the previous last workday."I have this calendar where 'L' stands for workday and 'F' stands for holiday ."

Migang_0-1720597005298.png

Migang_4-1720597594715.png

 

Migang_2-1720597075490.png

Migang_3-1720597117764.png

 

 

 



@Migang 

maybe you can try to create a flag column in date table 

 

Column =
var _last=maxx(FILTER('Table','Table'[date]<today()&&'Table'[Type]="L"),'Table'[date])
return if ('Table'[date]<=_last,"y")
 
11.PNG
 
and add this new column to filter and set the value to "y"




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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