Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
MVP & Luminary
MVP & Luminary

Re: Multiple If Statements in Chart

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

- Marcus

View solution in original post

8 Replies
Highlighted
Champion
Champion

Re: Multiple If Statements in Chart

Hi,

what do you mean by "merge them together" ?

2 conditions with 2 different results

Highlighted

Re: Multiple If Statements in Chart

How about this?

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted
MVP & Luminary
MVP & Luminary

Re: Multiple If Statements in Chart

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

- Marcus

View solution in original post

Highlighted
Creator II
Creator II

Re: Multiple If Statements in Chart

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,

Highlighted
Creator II
Creator II

Re: Multiple If Statements in Chart

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

Highlighted
Champion
Champion

Re: Multiple If Statements in Chart

@craig157


the answer of marcus is perfect i think

Highlighted
Creator II
Creator II

Re: Multiple If Statements in Chart

actually ignore me!!

Highlighted
Creator II
Creator II

Re: Multiple If Statements in Chart

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

Thanks again!