Forum Discussion

dk_24's avatar
dk_24
Icon for Helper I rankHelper I
9 years ago
Solved

Week to date sales

Hi All ,

 

How to implement the below tableau logic in Power BI.

 

if OrderDate >= DATETRUNC('WEEK',TODAY()) AND OrderDate<= TODAY() then sum(sales) END

 

Here  DATETRUNC('WEEK',TODAY()) ----> Will get the starting date of the week (9/10/2017)

TODAY()---> will get the today's date .

 

Thanks,

DK.

  • Anonymous's avatar
    Anonymous
    8 years ago

    HI dk_24,

     

    You can use below formula to get the week start date.

    WeekStart = [Date] + (1 - WEEKDAY([Date],1))
    

     

    For your scenario, it will be modified like:

    WeekStart = TODAY() + (1 - WEEKDAY(TODAY(),1))

     

    Regards,

    Xiaoxin Sheng

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI dk_24,

     

    You can use below formula to get the week start date.

    WeekStart = [Date] + (1 - WEEKDAY([Date],1))
    

     

    For your scenario, it will be modified like:

    WeekStart = TODAY() + (1 - WEEKDAY(TODAY(),1))

     

    Regards,

    Xiaoxin Sheng