Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

"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.

 

  • Anonymous 

    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")
     
     
    and add this new column to filter and set the value to "y"

3 Replies

  • Anonymous 

    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?

    • Anonymous's avatar
      Anonymous
      Not applicable

      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 ."

       

       

       

       



      • ryan_mayu's avatar
        ryan_mayu
        Super User

        Anonymous 

        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")
         
         
        and add this new column to filter and set the value to "y"