Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
craig157
Creator II
Creator II

Multiple If Statements in Chart

Hi All,

I have two conditions I want to include in a reporting chart.

If ( [Unit] = 'Grams', [Level])

and

If ([Unit] = 'Kilograms', ( [Level]/100 )

How can I merge these together?!

I will have more too add but I need this to work first (the others will have similar functions that manipulate the [Level] field

Thanks,

Craig

1 Solution

Accepted Solutions
marcus_sommer

You could use: pick(match([Unit], 'Grams', 'Kilograms'), [Level], [Level] / 1000)

- Marcus

View solution in original post

8 Replies
YoussefBelloum
Champion
Champion

Hi,

what do you mean by "merge them together" ?

2 conditions with 2 different results

Anil_Babu_Samineni

How about this?

If(Unit = 'Grams', Level, If(Unit= 'Kilograms', Level/100)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
marcus_sommer

You could use: pick(match([Unit], 'Grams', 'Kilograms'), [Level], [Level] / 1000)

- Marcus

craig157
Creator II
Creator II
Author

Hi Youssef,

Basically I have multiple units such as: Grams, Kilograms, Litres, Pounds etc.

In this chart I only want to display Grams & Kilograms.

But as Kilograms is 100 times bigger than grams I want to divide it by 100.

Thanks,

craig157
Creator II
Creator II
Author

Hi Marcus, an error appears highlighting the first [Level] section

YoussefBelloum
Champion
Champion

@craig157


the answer of marcus is perfect i think

craig157
Creator II
Creator II
Author

actually ignore me!!

craig157
Creator II
Creator II
Author

yes he was correct! I didn't notice the field name was 'Levels' which explains the error... Woops!

Thanks again!