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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ak2020
Regular Visitor

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

1 ACCEPTED SOLUTION

Hi @ak2020 

 

you can try the following.

 

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

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


View solution in original post

1 REPLY 1

Hi @ak2020 

 

you can try the following.

 

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

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.