Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

from IF to set analysis

Hi all,

I'm currently working on a report which uses a lot of IF statements. I prefer to change these expressions using IF into expressions using set analysis. But I'm running into some issues..  Hopefully someone can help me out.

Old situation:

sum  ( {<Jaar, Maandnr = >} if( Jaar =GetFieldSelections(Jaar)

and Maandnr =GetFieldSelections(Maandnr)

and Orders.Order_Type='Verkoop'

and DIM_Budget_Item.Budget_Item_Omschrijving='schoenen'

and Orders.Bedrag_Exclusief<>0,

Orders.Aantal_Artikelen))

New Situation:

Rewriting the old expression I ended up with the following expression. This expression gave the same outcome as the 'old situation', but I still had to use an IF statement..

sum(

{$< DIM_Budget_Item.Budget_Item_Omschrijving={'schoenen'},

Orders.Order_Type={'verkoop'}

>}

if ( Orders.Bedrag_Exclusief <>0,

Orders.Aantal_Artikelen))

What does not work..

Trying to leave out all the IF statements I ended up with the following expression, unfortunately this expression does nu give the same result as the two former expressions.

sum(

{$ < DIM_Budget_Item.Budget_Item_Omschrijving={'schoenen'},

Orders.Order_Type={'verkoop'}, Orders.Bedrag_Exclusief -= {0}

>} Orders.Aantal_Artikelen)

So for now I'm stuck with the 'new situation'.

17 Replies
tresesco
MVP
MVP

It looks fine. Where are you using this expression? In a chart ? If so, what are the dimensions? Could you post a sample of your qvw?

arulsettu
Master III
Master III

maybe this

sum(

{$ < DIM_Budget_Item.Budget_Item_Omschrijving={'schoenen'},

Orders.Order_Type={'verkoop'}, Orders.Bedrag_Exclusief -= {'0'}

>} Orders.Aantal_Artikelen)

or post a sample app

Not applicable
Author

I'm using this expression in a pivot table. What do you mean with posting a sample?

Not applicable
Author

Unfortunately this does not work. The expression still returns a different value.

tresesco
MVP
MVP

Attach a small sample qvw. Click on 'use advanced editor' (top right corner) ->Attach (bottom right)

sasiparupudi1
Master III
Master III

please try

{$ < [DIM_Budget_Item.Budget_Item_Omschrijving]={'schoenen'},

[Orders.Order_Type]={'verkoop'}, [Orders.Bedrag_Exclusief] = {"*"}-{0}

>} [Orders.Aantal_Artikelen])

Not applicable
Author

this expression does not work, it results in --> -

Not applicable
Author

Hi,

what columns do you use in the pivot table? (dimensions and metrics)

Your set analysis is correct, so there must be something else that is causing the problem..

seems strange that your "New situation" works, but not your latest complete set

/Pierre

Anonymous
Not applicable
Author

The "doesn't work" and "returns a different value" is not exactly the same...  You'd better attach an example as tresesco‌ sais.