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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
oliverome
Regular Visitor

Using DAX for converting dates to status categories

Hi all, I have a question about using DAX to convert dates into a corresponding status.

I have a column with calibration due dates for some equipment. There are a few possibilities:

- The equipment has a date 4 or more months in the future. All is good. 

- The equipment has a date less than 4 months in the future. I need to set up a new calibration.

- The equipment has a date in the past. This is not good, urgent action is needed.

- The cell is blank. There is no information available on the calibration due date. Also not good, but a different kind of action is needed.

 

How do I write DAX code to make this distinction?

 

I have tried this, for example:

IsCalibrationDue =
IF(
    [calibration_due] <= TODAY() || [calibration_due] <= EOMONTH(TODAY(), 4),
    TRUE,
    FALSE
)
 
This returns True if a cell is blank, or the calibration date is in the past or within the next 4 months. False if the date is further in the future. But that's not all I need. I need more categories, but I can't figure it out.
Can you help me? I am new to Power BI and DAX, so I'd really appreciate it.
1 ACCEPTED SOLUTION

Thank you again for your help! The first if-statement needed a slight modification, as it interpreted a blank cell as 0, therefore giving all blank cells the output 'urgent action required'. I have added an 'is not blank' statement to that line and now it works perfectly.

 

Thanks!

 

IsCalibrationDue = 

IF (  [calibration_due]  <= TODAY() && NOT(ISBLANK([calibration_due])), "Urgent Action Required",
IF (  [calibration_due]  >= EDATE(TODAY(), 3), "OK",
IF (  [calibration_due] > TODAY() && [calibration_due] < EDATE(TODAY(), 3), "Set up new Calibration",
IF ( [calibration_due] = BLANK(), "Set Up Calibration Date"))))

 

 

View solution in original post

4 REPLIES 4
Joe_Barry
Super User
Super User

Hi @oliverome 

Please try the following

 

 

 

Status =
IF (  [calibration_due]  <= TODAY(), "Urgent Action Required",
IF (  [calibration_due]  >= EDATE(TODAY(), 3), "OK",
IF (  [calibration_due] > TODAY() && [calibration_due] < EDATE(TODAY(), 3), "Set up new Calibration",
IF ( [calibration_due] = BLANK(), "Set Up Calibration Date")

 

 

 

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn


Let's connect on LinkedIn


Hi Joe,

Thanks for your help. Your code gave me an error as I don't have an 'incidents' column. I replaced those parts, and ended up with this:

 

IsCalibrationDue =
IF (  [calibration_due]  <= TODAY(), "Urgent Action Required",
IF (  [calibration_due]  >= EDATE([calibration_due].[Date], 4), "OK",
IF (  [calibration_due] > TODAY() && [calibration_due] < EDATE([calibration_due].[Date], 4), "Set up new Calibration",
IF ( [calibration_due] = BLANK(), "Set Up Calibration Date"))))
 
This returns only 2 outputs: 
- 'Set up new calibrations': this output appears for every cell that contains a date, regardless of when that date is.
- 'Urgent action required': this output appears for all empty cells.
 
Any ideas on how to proceed?

Sorry, I edited afterwards as I seen an error, please give the below a shot

Status =
IF (  [calibration_due]  <= TODAY(), "Urgent Action Required",
IF (  [calibration_due]  >= EDATE(TODAY(), 3), "OK",
IF (  [calibration_due] > TODAY() && [calibration_due] < EDATE(TODAY(), 3), "Set up new Calibration",
IF ( [calibration_due] = BLANK(), "Set Up Calibration Date")

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn


Let's connect on LinkedIn


Thank you again for your help! The first if-statement needed a slight modification, as it interpreted a blank cell as 0, therefore giving all blank cells the output 'urgent action required'. I have added an 'is not blank' statement to that line and now it works perfectly.

 

Thanks!

 

IsCalibrationDue = 

IF (  [calibration_due]  <= TODAY() && NOT(ISBLANK([calibration_due])), "Urgent Action Required",
IF (  [calibration_due]  >= EDATE(TODAY(), 3), "OK",
IF (  [calibration_due] > TODAY() && [calibration_due] < EDATE(TODAY(), 3), "Set up new Calibration",
IF ( [calibration_due] = BLANK(), "Set Up Calibration Date"))))

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.