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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
heathernicole
Continued Contributor
Continued Contributor

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?

~heathernicoale
1 ACCEPTED SOLUTION
heathernicole
Continued Contributor
Continued Contributor

Figured it out!! 😄  Code is included in screenshot. 🙂

 

Current Year Customers.JPG

~heathernicoale

View solution in original post

2 REPLIES 2
heathernicole
Continued Contributor
Continued Contributor

Figured it out!! 😄  Code is included in screenshot. 🙂

 

Current Year Customers.JPG

~heathernicoale

@heathernicole Great Job once again!

 

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

 

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 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.