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
sunny_talwar

May be this:

RangeSum(Above(

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

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

-

0.06)

*

(Only({<Name = >}[Date]) - Above(Only({<Name = >}[Date])))  ,  0, RowNo())))

alec1982
Specialist II
Specialist II
Author

Still giving wrong values when I select a different name. Shouldn't we add the name value on the added set analysis

sunny_talwar

Well if without selection you are getting the right number, I wouldn't add the whole set analysis of Name = {'ABC'} to the Date portion.

I don't see any reason for this to not work. Can you share the screenshot of the expression? and also two screenshots of the objects with and without selection in Name field?

sunny_talwar

Also there seems to be an extra parenthesis as the end...


=RangeSum(Above(

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

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

-

0.06)

*

(Only({<Name = >}[Date]) - Above(Only({<Name = >}[Date])))  ,  0, RowNo()))

alec1982
Specialist II
Specialist II
Author

I think the issue is with the value where it shows as 0.06. this is not the actual value on the expression

I use a variable instead of the value and the variable is set to be

Set vYFactor =

if(

GetSelectedCount([X_Factor.Location])=0,

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

        only([X_Factor.Storage Paid])

the table with the factors info is a data island.

When I hard code the value and add for example 0.06 it works fine..

If I add the expression above instead of the hard coded value, I get the right info but if I make selection on the name, it gives wrong info

sunny_talwar

Ignore Name here too then...

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

alec1982
Specialist II
Specialist II
Author

even if use

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

I get the right values if nothing is selected but wrong values if I select any Name.

sunny_talwar

Give this a shot

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


and see what you get

alec1982
Specialist II
Specialist II
Author

same issue...