Forum Discussion
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
- parry2kSuper 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" )- knowledgesearchHelper I
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.
- parry2kSuper User
knowledgesearch there was a typo, it is fixed now.
- knowledgesearchHelper I
It still says there is an error the syntax for return is incorrect
- parry2kSuper 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.