Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using GetFieldSelections in an expression

Hi,

Hopefully a quick question.

I have a master calendar and an assoicated table full of sales values.  What I want is two columns in a straight table, the first showing the values from the selected year from a listbox populated from the master calendar.  The second column needs to show the values from the previous year.

I have left the first column's expression as =Sum([DAILYSALES-SALES-VALUE-EXTAX])

The second column's expression as =Sum({$<CALENDARYEAR=GetFieldSelections(CALENDARYEAR)-1> [DAILYSALES-SALES-VALUE-EXTAX])

The editor says there is a syntax error, but I dont't know how to fix it.

Can someone point me in the right direction with regards to using GetFieldSelections within an expression, or alternatively is there another/better way to get year on year comparison within a straight table, where the user either selects a single year from a list box, or has to select two years?

Thanks

Trevor

6 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Use Expression as

     =Sum({$<CALENDARYEAR={$(=Max(CALENDARYEAR)-1)}> [DAILYSALES-SALES-VALUE-EXTAX])

Celambarasan

lironbaram
Partner - Master III
Partner - Master III

you need to change to

Sum({$<CALENDARYEAR={"$(=GetFieldSelections(CALENDARYEAR)-1)"}> [DAILYSALES-SALES-VALUE-EXTAX])

Not applicable
Author

Hi Syntax now shows as ok, but I don't get any data returned at all

Not applicable
Author

Hi, as per other post, syntax shows ok, but still no data being returned.  The syntax looks very strange to me?  What is the purpose of all the double quotes ?  I can't find anything about this in the reference guide.

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Check with this expression

     =Sum({$<CALENDARYEAR={'$(=Max(CALENDARYEAR)-1)'}> [DAILYSALES-SALES-VALUE-EXTAX])

Celambarasan

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this expression

   =Sum({$<CALENDARYEAR={'=$(=Max(CALENDARYEAR)-1)'}> [DAILYSALES-SALES-VALUE-EXTAX])

Hope this helps you.

Regards,

Jagan.