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

Multiple conditions with IF (calculated, conditional column)

I have a baseline date measure for project tasks and todays measure, I want an if statement that states if the date is greater than or equal to 30 days then the RAG status is green, if the date is less than 30 then it is amber, if it less than 10 days then it is red. 

 

The measure i can is =if [Baseline Date]-[Today's Date]>=30 , ="Green", or if [Baseline Date]-[Today's Date]<=30, = "Amber" or if [Baseline Date]-[Today's Date]<=30 , ="Red")))

 

Am I doing something wrong, I have searched numerous forums and pages but all are coming up with either nested IF statements that do not work or other measures that don't quite fit my condition. 

5 REPLIES 5
parry2k
Super User
Super User

@knowledgesearch Not sure what else I can say based on the information you provided. Maybe share a sample pbix file using one drive/google drive and remove the sensitive information before sharing.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@knowledgesearch there was a typo, it is fixed now.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

It still says there is an error the syntax for return is incorrect

parry2k
Super User
Super User

@knowledgesearch It is much easier with switch, although you can also do with IF but SWITCH is easy to read and debug.

 

 

VAR __Days = [Baseline Date]-[Today's Date]
RETURN
SWITCH ( TRUE (),
   __Days >= 30, "Green",
   __Days >= 10, "Amber",
   "Red"
)

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

It is saying incorrect syntax for return, this is a calculated column measure I have a calculated column that calculates the difference between the baseline and today's date. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.