Forum Discussion

ak2020's avatar
ak2020
Frequent Visitor
4 years ago
Solved

Different DATEADD values using IF conditions

Hi, 

 

I'm trying to create a single Last Year measure which accounts for different phasing of financial years. Previously I used DATEADD as there was just one year to look back on but now there are several.

 

CALCULATE(
    [SALESĀ£],
        DATEADD('DATE-table'[DATE], -371, DAY)

 

Is it possible to create a conditional measure that can DATEADD two different values? It either needs to look back at 365 days or 371 days, depending on the financial year of the date that is being looked at.

 

Logic

If date > 02/04/2022 then DATEADD -365, otherwise DATEADD -371

  • Hi ak2020 

     

    you can try the following.

     

    IF(MAX('Calendar'[Date]) > DATE(2022,04,02),-365,-371)

     

1 Reply

  • mwegener's avatar
    mwegener
    Most Valuable Professional

    Hi ak2020 

     

    you can try the following.

     

    IF(MAX('Calendar'[Date]) > DATE(2022,04,02),-365,-371)