Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

siddharthsoam
Contributor

can we have multiple true values in if

I want to have multiple true values for a condition in if statement in qliksense

ex-

quarter   previous quarters

3                 1

                   2

please help me with the problem

1 Solution

Accepted Solutions
felipedl
Valued Contributor III

Re: can we have multiple true values in if

Hi Siddhart,

If I understood your question, you need to create a table with previous quarters based on quarter values.

The following script:

x:

Load * Inline

[

Quarter

1

2

3

4

];

y:

Load

Quarter,

if (Quarter=1,Null(),IterNo()) as [Previous Quarter]

Resident x

While IterNo() <=Quarter;

drop table x;

NoConcatenate

data:

Load

Quarter,

[Previous Quarter]

Resident y

where Quarter <> [Previous Quarter];

drop table y;

Gets the following output:

Sample.png

Since you now have the Quarter and Previous Quarter mapped out, now you could do the if statement on the new field.

Is that what you need?

1 Reply
felipedl
Valued Contributor III

Re: can we have multiple true values in if

Hi Siddhart,

If I understood your question, you need to create a table with previous quarters based on quarter values.

The following script:

x:

Load * Inline

[

Quarter

1

2

3

4

];

y:

Load

Quarter,

if (Quarter=1,Null(),IterNo()) as [Previous Quarter]

Resident x

While IterNo() <=Quarter;

drop table x;

NoConcatenate

data:

Load

Quarter,

[Previous Quarter]

Resident y

where Quarter <> [Previous Quarter];

drop table y;

Gets the following output:

Sample.png

Since you now have the Quarter and Previous Quarter mapped out, now you could do the if statement on the new field.

Is that what you need?

Community Browser