Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
s_herrera_pugli
Partner - Contributor
Partner - Contributor

Conditional expression in Straight Table

Hi all,

i want to use a conditional in one of the expressions of my straight table.

I want the metric appear or disappear depending on the field, example

if i have vendor=1 i want the expression to make a sum(), so as if i have vendor=2 but if i have vendor=3 i want to appear nothing like ' '.

I used this expression(obviously didn't work): =if(Vendor= '1', sum([metric_1]), if(Vendor= '2', sum([metric_1]), ' '))

I tried backwards as: =if(Vendor= '3', ' ', sum([metric_1]))

didn't work either.

I hope you could help me!

thanks in advance

4 Replies
sunny_talwar

Try this instead

Sum({<Vendor = {'1', '2'}>}[metric_1])
s_herrera_pugli
Partner - Contributor
Partner - Contributor
Author

sill doesn't work, it shows the same for all the fields (the sum of the expression) despite the vendor

sunny_talwar

Would you be able to show this using an example?

Vegar
MVP
MVP

Have your checked the spelling?

If you are making selections to vendor then you could adjust @sunny_talwar expression like this.
Sum({<Vendor *= {'1', '2'}>}[metric_1])