Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a requirement wherein i need to build a chart with a cyclic group having the dimensions Status and Priority wherein i need Status to have a background color as
If([Status]='S1', RGB(229, 182, 148), //brown
If([Status]='S2', RGB(65, 167, 70), //Green
If([Status]='S3', RGB(80, 160, 240), //Blue
If([Status]='S4', RGB(255, 217, 47), //
If([Status]='S5, RGB(171, 233, 198),
If([Status]='S6', RGB(221, 66, 66), //Cyan
If([Status]='S6', ARGB(90, 255, 0,0),
)))))))
The priorities in the chart to have a background color as
If(only({1}[ Priority])='Priority-1', ARGB(255, 255, 0, 0),
If(only({1}[ Priority])='Priority-2', RGB(255, 217, 47),
If(only({1}[ Priority])='Priority-3', RGB(80, 160, 240),
If(only({1}[ Priority])='Priority-4', RGB(187, 216, 84),))))
So now that I have two dimensions it is not possible to put them in the expressions tab.Please let me know how this could be done.
Yes you can do it,
firstly use getcurrentfield([Group Name]) function
ie,
if(getcurrentfield([Group Name])='Status',
If([Status]='S1', RGB(229, 182, 148), //brown
If([Status]='S2', RGB(65, 167, 70), //Green
If([Status]='S3', RGB(80, 160, 240), //Blue
If([Status]='S4', RGB(255, 217, 47), //
If([Status]='S5, RGB(171, 233, 198),
If([Status]='S6', RGB(221, 66, 66), //Cyan
If([Status]='S6', ARGB(90, 255, 0,0),
))))))),
If(only({1}[ Priority])='Priority-1', ARGB(255, 255, 0, 0),
If(only({1}[ Priority])='Priority-2', RGB(255, 217, 47),
If(only({1}[ Priority])='Priority-3', RGB(80, 160, 240),
If(only({1}[ Priority])='Priority-4', RGB(187, 216, 84),))))
)
hope this will help you out
It's easier than it looks. You can use the group name as the field name in the test. For example if your group name is "MyGroup"
=If([MyGroup]='S1', RGB(229, 182, 148), //brown
If([MyGroup]='S2', RGB(65, 167, 70), //Green
If([MyGroup]='Priority-1', ARGB(255, 255, 0, 0),
If([MyGroup]='Priority-2', RGB(255, 217, 47)
))))
I'm not sure why you were using the only() function in your previous example.
-Rob
This works for me and is a simpler expression. Thanks Rob.
Hi Rob,
Incase there are no values for a particular condition the color coding would fail i mean incase the function returns null values the color coding would thus only was used in the exp
Go ahead and mark my answer correct to close the thread if it answers your group question.
Rob