Forum Discussion

Puja's avatar
Puja
Icon for Helper III rankHelper III
3 years ago

Date challenge

Hello All,

This below measure is working fine. 

DateValue =
VAR Rank_ = Divide(CEILING([Rank)],6),6,0)
Return
TODAY() -1 + Rank_

How can I exclude weekends ?

for example, if Saturday gets rank 4, then it should be assigened to monday , if sunday gets rank 5 then it should be aligned with Tuesday. 

Thanks in advance.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Puja ,

     

    Please try this measure.

    DateValue =
    VAR Rank_ = Divide(CEILING([Rank)],6),6,0)
    VAR BaseDate = TODAY() - 1 + Rank_
    VAR DayOfWeek = WEEKDAY(BaseDate, 2)
    RETURN
        IF(
            DayOfWeek = 6, BaseDate + 2,
            IF(DayOfWeek = 7, BaseDate + 1, BaseDate)
        )

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

    • Puja's avatar
      Puja
      Icon for Helper III rankHelper III

      Hi Anonymous , Thanks for looking into it.

      This solution is working only for the current week. But it is adding monday and tuesday twice in the next week.  Please see below

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Puja ,

         

        I'm sorry I don't quite understand what you mean.

        Please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

         

        Best Regards,

        Neeko Tang