Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

Exclude Selection from Expression

hi all,

the following expression works fine for me and supposed to make calculation for specific name as added on the set analysis.

Now when I go on my list box "Name" and make different selection, it changes the numbers and give wrong values. how can I make sure the values dont change when I select a value on the Name column?

RangeSum(Above(

((Sum({$<Flag  = {'1'}, [Name]= {'ABC'}>}[Price]) - above(Sum({$<Flag  = {'1'}, [Name]= {'ABC'}>}[Price]))) 

/  ([Date] - above([Date]))

-

0.06)

*

([Date] - above([Date]))  ,  0,RowNo())))

20 Replies
alec1982
Specialist II
Specialist II
Author

Even replacing the it with just [X_Factor.Storage Paid] and make selection via UI.. doesn't work:(

alec1982
Specialist II
Specialist II
Author

Here is a screenshot of the current expression with the values in it

qliksus
Specialist II
Specialist II

To narrow down the issue divide the exp is 2 parts

Exp1 :

RangeSum(Above(

((Sum({$<Flag  = {'1'}, [Name]= {'ABC'}>}[Price]) - above(Sum({$<Flag  = {'1'}, [Name]= {'ABC'}>}[Price]))) 

/  ([Date] - above([Date]))

Exp2 :  If ( getselectedcount(X.factor) = 0  ,.......................)

Now select the Name   and see which part is changing to narrow it down or plz attach a sample file

alec1982
Specialist II
Specialist II
Author

hi,

Thank you for your reply.

Do you mean create two measures on two columns?

sunny_talwar

Would you be able to paste your expression as text? Would be easy to make changes to

alec1982
Specialist II
Specialist II
Author

Sure, and thanks for all the help:

if(rank(

RangeSum(Above(

((Sum({$<Third_Mature_Wed_Flag  = {'1'}, [MetalName]= {'Aluminium'}>}[Spread Net Price]) - above(Sum({$<Third_Mature_Wed_Flag  = {'1'}, [MetalName]= {'Aluminium'}>}[Spread Net Price]))) 

//  ([Mature Date] - above([Mature Date]))

// (Only({<MetalName = >}[Mature Date]) - Above(Only({<MetalName = >}[Mature Date])))

/  (Only({<MetalName = {'Aluminium'}>}[Mature Date]) - Above(Only({<MetalName = {'Aluminium'}>}[Mature Date])))

-

If(GetSelectedCount([X_Factor.Location]) = 0, Only({<[X_Factor.Location]={'Average'}>}[X_Factor.Storage Paid]),

        Only({<[X_Factor.Location]={'Average'}>}[X_Factor.Storage Paid])))

//0.053417)

*

(Only({< MetalName = {'Aluminium'}>}[Mature Date]) - Above(Only({<MetalName = {'Aluminium'}>}[Mature Date])))

,

0,RowNo()))) <= 5,

RangeSum(Above(

((Sum({$<Third_Mature_Wed_Flag  = {'1'}, [MetalName]= {'Aluminium'}>}[Spread Net Price]) - above(Sum({$<Third_Mature_Wed_Flag  = {'1'}, [MetalName]= {'Aluminium'}>}[Spread Net Price]))) 

/  (Only({<MetalName = {'Aluminium'} >}[Mature Date]) - Above(Only({<MetalName = {'Aluminium'}>}[Mature Date])))

-

If(GetSelectedCount([X_Factor.Location]) = 0, Only({<[X_Factor.Location]={'Average'}>}[X_Factor.Storage Paid]),

        Only({<[X_Factor.Location]={'Average'}>}[X_Factor.Storage Paid])))

//0.053417)

*

(Only({<MetalName = {'Aluminium'}>}[Mature Date]) - Above(Only({<MetalName ={'Aluminium'} >}[Mature Date])))

,

0,RowNo())))

sunny_talwar

How about this:

If(Rank(

RangeSum(Above(

((Sum({$<Third_Mature_Wed_Flag  = {'1'}, [MetalName]= {'Aluminium'}>}[Spread Net Price]) - Above(Sum({$<Third_Mature_Wed_Flag  = {'1'}, [MetalName]= {'Aluminium'}>}[Spread Net Price])))

/  (Only({<MetalName = {'Aluminium'}>}[Mature Date]) - Above(Only({<MetalName = {'Aluminium'}>}[Mature Date])))

-

If(GetSelectedCount([X_Factor.Location]) = 0, Only({<[X_Factor.Location]={'Average'}, MetalName = >}[X_Factor.Storage Paid]),

        Only({<[X_Factor.Location]={'Average'}, MetalName = >}[X_Factor.Storage Paid])))

//0.053417)

*

(Only({< MetalName = {'Aluminium'}>}[Mature Date]) - Above(Only({<MetalName = {'Aluminium'}>}[Mature Date])))

,

0,RowNo()))) <= 5,

RangeSum(Above(

((Sum({$<Third_Mature_Wed_Flag  = {'1'}, [MetalName]= {'Aluminium'}>}[Spread Net Price]) - above(Sum({$<Third_Mature_Wed_Flag  = {'1'}, [MetalName]= {'Aluminium'}>}[Spread Net Price])))

/  (Only({<MetalName = {'Aluminium'} >}[Mature Date]) - Above(Only({<MetalName = {'Aluminium'}>}[Mature Date])))

-

If(GetSelectedCount([X_Factor.Location]) = 0, Only({<[X_Factor.Location]={'Average'}, MetalName =>}[X_Factor.Storage Paid]),

        Only({<[X_Factor.Location]={'Average'}, MetalName =>}[X_Factor.Storage Paid])))

//0.053417)

*

(Only({<MetalName = {'Aluminium'}>}[Mature Date]) - Above(Only({<MetalName ={'Aluminium'} >}[Mature Date])))

,

0,RowNo())))

alec1982
Specialist II
Specialist II
Author

same issue.. if you need I can send you a join me to see it if that help

sunny_talwar

I have a meeting in 15 minutes, may be I can come back to this at a later point

alec1982
Specialist II
Specialist II
Author

that would be greatly appreciated.

Also, I sent you a message about accessing the test server. Let me know if you didnt get it

Thanks again