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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
sarah8991
Frequent Visitor

Labelling Expired, Soon to Expire and Valid from End Date column

Hi,

 

I just started learning DAX- not sure if this should be done in DAX or Power Query. But what I'm trying to do is have a column that is automated to output "Expired", "Soon to Expire" and "Valid" depending on the "End Date" column. 

 

The "End Date" column feeds from our internal server. The output labelled "Soon to Expire" when the "End Date" is within 3 months from today.

 

sarah8991_0-1648140842149.png

 

Please advise how to get this.

 

Thanks!

 

1 ACCEPTED SOLUTION
truptis
Community Champion
Community Champion

Hi @sarah8991 , Please check if the datatype of End Date column is a String or Date. If it is String then convert it into Date.
Also, Try this:
Result = if(day([enddate]) > Today(), "Expired", if(day([end date])+90 < Today(),"Valid", "Soon to expire"))

 

@sarah8991 -> hit the thumbs up & mark it as a solution if it helps you. Thanks.

View solution in original post

5 REPLIES 5
truptis
Community Champion
Community Champion

Hi @sarah8991 , Please check if the datatype of End Date column is a String or Date. If it is String then convert it into Date.
Also, Try this:
Result = if(day([enddate]) > Today(), "Expired", if(day([end date])+90 < Today(),"Valid", "Soon to expire"))

 

@sarah8991 -> hit the thumbs up & mark it as a solution if it helps you. Thanks.

Hi,

 

Thank you! I changed it to Date and tried your suggestion, but now it can't seem to locate the "End Date" colum:

sarah8991_0-1648144513235.png

 

Do you know why this is happening? 

 

Thanks!

Hi @sarah8991 ,

Try this:

Result = if(day('tablename'[enddate]) > Today(), "Expired", if(day('tablename'[end date])+90 < Today(),"Valid", "Soon to expire"))

I changed it a bit and it works now, thank you 🙂 

HotChilli
Super User
Super User

"End Date" is just a string. You can't use DAY on a string.

When writing an IF statement, I always advise to start with a simple comparison and get that to work, so just try getting one part to work.

here's some examples: https://docs.microsoft.com/en-us/dax/if-function-dax?WT.mc_id=DP-MVP-4025372#examples 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors