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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
psmith-nhs-inc
Helper III
Helper III

DateAdd() math cutting off at year mark

OK.  I have a calculated column on my Date table.  I want to know if any particular date is within the last 365 days of today, or the previous 365 days.  I think this should give it to me.  Looking at this today, it should return CY365 for any date between 6/25/2017 and 6/24/2018.  (And future dates, but not relevant. here)

 

Instead, what I get is dates between 6/25/2017 and 12/31/2017.  PY365 shows for dates between 6/25/2016 and 12/31/2017.

Take the date, Add 365 days to it, and if the result is later than today, then that date is within 365 days of today.  Right?

 

CYisCurrent365 =
IF (
    DATEADD ( 'Date'[Date], +365, DAY ) >= TODAY (),
    "CY365",
    IF ( DATEADD ( 'Date'[Date], +730, DAY ) >= TODAY (), "PY365", BLANK () ))

 

What is wrong with my thinking here?

 

Phil

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

Does this work?

=IF('Date'[Date]>=TODAY()-365,"CY365",IF('Date'[Date]>=TODAY()-730,"PY365",BLANK()))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @psmith-nhs-inc,

 

Have you solved your problem?

 

If you have solved, could you share your solution or always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please share your data sample and your desired output, so that we can help further investigate on it?

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

 

Does this work?

=IF('Date'[Date]>=TODAY()-365,"CY365",IF('Date'[Date]>=TODAY()-730,"PY365",BLANK()))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Sorry for the delay. Other projects were taking precedence.  Yes, this does work.  Thank you.

 

Do you have an explanation as to why my formula did not work?  Problem solved, but the mystery still exists.

 

In either case, thank you.

 

Phil

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.