Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Previous Value of the Expression

Hi,

Suppose I have a straight table with three dimensions and one expression, and the expression has nested If statement along with Fractile() function.

Straight_Table_1.PNG

When I select second row i.e. Test1, the value in the Metric is changing.

Our requirement is the Metric value should not change even if user selects any row in the straight table. Is there is any way, that I can get the previous value of the expression. I have tried Previous() and Only() function, but as the expression has nested If statements, the application hangs.

Waiting for inputs.

Thanks & Regards,

MK

1 Solution

Accepted Solutions
sunny_talwar

Try this formula:

=if((C+B) <= fractile({<Name = , B = , C = >}TOTAL aggr((Only({<Name = , B = , C = >}C)+Only({<Name = , B = , C = >}B)),Name), 0.1), 10,

if((C+B) <= fractile({<Name = , B = , C = >}TOTAL aggr((Only({<Name = , B = , C = >}C)+Only({<Name = , B = , C = >}B)),Name), 0.2), 12,

if((C+B) <= fractile({<Name = , B = , C = >}TOTAL aggr((Only({<Name = , B = , C = >}C)+Only({<Name = , B = , C = >}B)),Name), 0.3), 14,

if((C+B) <= fractile({<Name = , B = , C = >}TOTAL aggr((Only({<Name = , B = , C = >}C)+Only({<Name = , B = , C = >}B)),Name), 0.4), 16, 

if((C+B) <= fractile({<Name = , B = , C = >}TOTAL aggr((Only({<Name = , B = , C = >}C)+Only({<Name = , B = , C = >}B)),Name), 0.5), 18, 

if((C+B) <= fractile({<Name = , B = , C = >}TOTAL aggr((Only({<Name = , B = , C = >}C)+Only({<Name = , B = , C = >}B)),Name), 0.6), 20, 

if((C+B) <= fractile({<Name = , B = , C = >}TOTAL aggr((Only({<Name = , B = , C = >}C)+Only({<Name = , B = , C = >}B)),Name), 0.7), 22, 

if((C+B) <= fractile({<Name = , B = , C = >}TOTAL aggr((Only({<Name = , B = , C = >}C)+Only({<Name = , B = , C = >}B)),Name), 0.8), 24,

if((C+B) <= fractile({<Name = , B = , C = >}TOTAL aggr((Only({<Name = , B = , C = >}C)+Only({<Name = , B = , C = >}B)),Name), 0.9), 26, 

if((C+B) <= fractile({<Name = , B = , C = >}TOTAL aggr((Only({<Name = , B = , C = >}C)+Only({<Name = , B = , C = >}B)),Name), 1.0), 28, 8))))))))))

View solution in original post

18 Replies
sunny_talwar

What exactly the expression looks like? Would you be able to share that, because without looking at the expression, it would be hard to give any suggestions.

Best,

Sunny

stigchel
Partner - Master
Partner - Master

When you select a row in a chart\table, you select corresponding values in the dimension(s). If you want this to have no effect on your calculations you need set analysis (see help). In this case that would be something like (example)

Sum({<Name,B,C>} Sales)

This disregards the selections in Name,B and C fields

Anonymous
Not applicable
Author

Thanks for the quick response sunindia‌,

The expression looks somewhat like -

=if(($(v1)+ $(v2)) <= fractile(TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.1), 10,

if(($(v1)+$(v2)) <= fractile(TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.2), 12,

if(($(v1)+$(v2)) <= fractile(TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.3), 14,

if(($(v1)+$(v2)) <= fractile(TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.4), 16, 

if(($(v1)+$(v2)) <= fractile(TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.5), 18, 

if(($(v1)+$(v2)) <= fractile(TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.6), 20, 

if(($(v1)+$(v2)) <= fractile(TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.7), 22, 

if(($(v1)+$(v2)) <= fractile(TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.8), 24,

if(($(v1)+$(v2)) <= fractile(TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.9), 26, 

if(($(v1)+$(v2)) <= fractile(TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 1.0),28, 8 ))))))))))

Thus, when I select only one row, by default the value becomes 10.

Please assist.

Thanks & Regards,

MK

Not applicable
Author

Share QVW file

sunny_talwar

Try this:

The expression looks somewhat like -

=if(($(v1)+ $(v2)) <= fractile({<Name = , B = , C =>}TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.1), 10,

if(($(v1)+$(v2)) <= fractile({<Name = , B = , C =>}TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.2), 12,

if(($(v1)+$(v2)) <= fractile({<Name = , B = , C =>}TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.3), 14,

if(($(v1)+$(v2)) <= fractile({<Name = , B = , C =>}TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.4), 16,

if(($(v1)+$(v2)) <= fractile({<Name = , B = , C =>}TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.5), 18,

if(($(v1)+$(v2)) <= fractile({<Name = , B = , C =>}TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.6), 20,

if(($(v1)+$(v2)) <= fractile({<Name = , B = , C =>}TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.7), 22,

if(($(v1)+$(v2)) <= fractile({<Name = , B = , C =>}TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.8), 24,

if(($(v1)+$(v2)) <= fractile({<Name = , B = , C =>}TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 0.9), 26,

if(($(v1)+$(v2)) <= fractile({<Name = , B = , C =>}TOTAL aggr(($(v1)+$(v2)

),dimenaion1), 1.0),28, 8 ))))))))))

Best,

Sunny

Anonymous
Not applicable
Author

I tried with your expression, but no luck.

The Metric is depending on the Name dimension, in that case, I cant ignore that as well.

Please assist.

Anonymous
Not applicable
Author

Tried this way, as well, no luck.

stigchel
Partner - Master
Partner - Master

It's not ignoring the Dimension, it's ignoring selections in the dimensions. See also Sunny's answer

stigchel
Partner - Master
Partner - Master

Then probably whatever is in $(v1)+$(v2) is also affected by the selection, use the same set analysis in these as well. Otherwise share your qvw