Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Help to change expression from "if"

Hi,

I have to expression that crashes my application because of the if statement in the expression.

Expression 1:

aggr(if(max(kWh) >=Max_verdi, sum(Max_verdi)),Kunde,Dato,Klokken)

Expression 2:

aggr(if(max(kWh) >=Max_verdi, Max(kWh)),Kunde,Dato,Klokken)

Anyone that can transform the expression to work without the if statement?

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Try this and see if it still hangs?

Expression 1:

= aggr(if(Max_verdi <= max(kWh) , sum(Max_verdi)),Kunde,Dato,Klokken)

Expression 2:

= aggr(if(Max_verdi <= max(kWh), Max(kWh)),Kunde,Dato,Klokken)

OR

Expression 1:

= aggr( SUM({< Yourkeyfield = {"=Max_verdi <= Max(kWh)"} >}Max_verdi),Kunde,Dato,Klokken)

Expression 2:

= aggr(max({< Yourkeyfield = {"=Max_verdi <= Max(kWh)"} >}kWh),Kunde,Dato,Klokken)

View solution in original post

8 Replies
vishsaggi
Champion III
Champion III

Try this and see if it still hangs?

Expression 1:

= aggr(if(Max_verdi <= max(kWh) , sum(Max_verdi)),Kunde,Dato,Klokken)

Expression 2:

= aggr(if(Max_verdi <= max(kWh), Max(kWh)),Kunde,Dato,Klokken)

OR

Expression 1:

= aggr( SUM({< Yourkeyfield = {"=Max_verdi <= Max(kWh)"} >}Max_verdi),Kunde,Dato,Klokken)

Expression 2:

= aggr(max({< Yourkeyfield = {"=Max_verdi <= Max(kWh)"} >}kWh),Kunde,Dato,Klokken)

Anonymous
Not applicable
Author

same problem.. because of the if statement. any other suggestion without if?

my data set is to big for the if statements.

vishsaggi
Champion III
Champion III

Did the set analysis worked? Are these the only expressions you have or do you have any other expressions? How do you know that IF is causing the problem?

Anonymous
Not applicable
Author

Expression 1:

= aggr( SUM({< Yourkeyfield = {"=Max_verdi <= Max(kWh)"} >}Max_verdi),Kunde,Dato,Klokken)

Expression 2:

= aggr(max({< Yourkeyfield = {"=Max_verdi <= Max(kWh)"} >}kWh),Kunde,Dato,Klokken)

Worked perfect Still a littlebit slow, but the application dosent crash. Thank you

Anonymous
Not applicable
Author

because when you use a if statement the expression search in your whole dataset insted of just the tables you want.

Anonymous
Not applicable
Author

i have three more from another chart table :

1: Count(aggr(if(max(kWh) >=Max_verdi, Max(kWh)),Kunde,Dato,Klokken))

2: Count(aggr(if(max(kWh) >=Max_verdi, Max(kWh)),Kunde,Dato))

3: Count(aggr(if(max(kWh) >=Max_verdi, Max(kWh)),Målepunktid))

kWh is the "yourkeyfied"

vishsaggi
Champion III
Champion III

Did you try using set analysis on all these count expressions as well ?

Anonymous
Not applicable
Author

yes, works perfect !   Thanks !