It's all about the answers!

Ask a question

Conditional statement in Custom Expressions


Mohit Agrawal (131) | asked Mar 30 '22, 8:28 a.m.

How do I write conditional statements in Custom Expressions. I am using Data Warehouse and my requirement is that I need to set value as 'High' if my value comes to 3, 'Medium' if value is 2, else 'Low'.

Accepted answer


permanent link
Jackie Albert (1.6k14947) | answered Mar 30 '22, 8:36 a.m.
Hi, you can use a Case statement in your custom expression -- my example is built for a DB2 database, but I think the SQL should be applicable across DB systems.   In my example I'm doing grouping by creation date, but you could substitute your attribute and text as appropriate.

CASE WHEN AGE(DATE($Work Item:Creation Date$)) < 11 THEN 'Age 0-10' WHEN (AGE(DATE($Work Item:Creation Date$)) > 10 AND AGE(DATE($Work Item:Creation Date$)) < 21) THEN 'Age 11-20' WHEN (AGE(DATE($Work Item:Creation Date$)) > 20 AND AGE(DATE($Work Item:Creation Date$)) < 31) THEN 'Age 21-30' ELSE 'Age +30' END
Mohit Agrawal selected this answer as the correct answer

Comments
Mohit Agrawal commented Mar 30 '22, 9:04 a.m.

Thanks @Jackie for an prompt answer

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.