Forum Discussion

heathernicole's avatar
heathernicole
Continued Contributor
10 years ago
Solved

Calculated Column that only pulls data for Current year

I am trying to create a calculated column that Counts the age of a customer in Days IF the time the customer was created was THIS YEAR.

 

I've come up with multiple IF statements but nothing has worked properly. 

 

This is part of what I've got:

 

To calculate the age (in days) - AGE=DATEDIFF(Customer[CustomerTimeCreated],TODAY(), DAY).

 

What I need to do is create an IF statement:

 

AGE OF CURRENT YEAR CUSTOMERS = IF(YEAR(Customer[CustomerTimeCreated])= "Current Year", DATEDIFF(Customer[CustomerTimeCreated],TODAY(), DAY), "Previous Year Customer")

 

Any ideas on the best way to do this?

2 Replies

  • heathernicole's avatar
    heathernicole
    Continued Contributor

    Figured it out!! :D  Code is included in screenshot. :)

     

    • Sean's avatar
      Sean
      Community Champion

      heathernicole Great Job once again!

       

      Yes you can't have a conditional statement produce a number if true and text if false.