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

Filter on an expression

Hi!

I have an expression which calculates difference between two other expressions. The code is rather difficult to undestand so I'll put it in the comment.

I want to create a filter that suppresses rows which don't match the selection.

I have two input boxes (amount from and amount to) with variables, then I need to use a set analysis or something like that, but I don't have an amount to compare, it's calculated in the expression.

in other words, i have:

expression 1 = a

expression 2 = b

expression 3= a - b

filter 1 (for example, the selection is 0)

filter 2 (for example, the selection is 1)

and i need to see only rows where a-b>=0 and a-b<=1

1 Solution

Accepted Solutions
Not applicable
Author

I think i answered my own question.

I should use if : if (a-b>=0 and a-b<=1,a-b)          on each expression.

Thanks to all who tried to help me!

View solution in original post

4 Replies
Not applicable
Author

if(ZnPok='-',

0

,aggr(distinct sum(

 

                    aggr( sum (distinct {$<

                              [InfoKZ.DeptDate] = {$(='">='&DATE(vFilterDateShipKZFrom_2) & '<=' &DATE(vFilterDateShipKZTo_2) & '"')}

                    >}ZakazKZ.purchSum)

                    *

                    only(

                    {$<

                              [k_plCurrencyRate.Date] = {$(='"'&DATE(varDate)&'"')}

                    >}

          k_plCurrencyRate.EXCHRATE

          ),  ZnPok, ZpG, k_plCurrencyRate.slCurCD)),

 

ZnPok, ZpG))

+

if(ZnPok='-',0,

aggr(distinct sum(

 

                    aggr( sum (distinct {$<

                              [InfoKZ.DeptDate] = {$(='">='&DATE(vFilterDateShipKZFrom_2) & '<=' &DATE(vFilterDateShipKZTo_2) & '"')}

                    >}NaklKZ.sum)

                    *

                    only(

                    {$<

                              [k_invCurrencyRate.Date] = {$(='"'&DATE(varDate)&'"')}

                    >}

          k_invCurrencyRate.EXCHRATE

          ), NaklKZ.INVOICE ,ZnPok, ZpG, k_invCurrencyRate.invCurCD)),

 

ZnPok, ZpG))

sujeetsingh
Master III
Master III

Hi,

Try using pre3vious selection concept.

You can use sum({1-$}sales) as to exclude current selection .

Not applicable
Author

in other words, i have:

expression 1 = a

expression 2 = b

expression 3= a - b

filter 1 (for example, the selection is 0)

filter 2 (for example, the selection is 1)

and i need to see only rows where a-b>=0 and a-b<=1

Not applicable
Author

I think i answered my own question.

I should use if : if (a-b>=0 and a-b<=1,a-b)          on each expression.

Thanks to all who tried to help me!