# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Contributor II

## 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. 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

Tags (5)
1 Solution

Accepted Solutions MVP

## Re: Previous Value of the Expression

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))))))))))

18 Replies MVP

## Re: Previous Value of the Expression

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 Partner

## Re: Previous Value of the Expression

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

Contributor II

## Re: Previous Value of the Expression

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.

Thanks & Regards,

MK Not applicable

## Re: Previous Value of the Expression

Share QVW file MVP

## Re: Previous Value of the Expression

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

Contributor II

## Re: Previous Value of the Expression

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.

Contributor II

## Re: Previous Value of the Expression

Tried this way, as well, no luck.  Partner

## Re: Previous Value of the Expression

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

## Re: Previous Value of the Expression

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