Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

gerrycastellino
Contributor III

How do I structure my set analysis to get next item sum

Test1.JPG

Tags (1)
1 Solution

Accepted Solutions

Re: How do I structure my set analysis to get next item sum

May be this?

=sum({<Item = {"$(=Item+1)" } >}  Sales)

7 Replies

Re: How do I structure my set analysis to get next item sum

May be this?

=sum({<Item = {"$(=Item+1)" } >}  Sales)

effinty2112
Honored Contributor

Re: How do I structure my set analysis to get next item sum

Try:

=sum({$<Item = {$(=FieldValue('Item', FieldIndex('Item',Only(Item))+1))}>}Sales)

If you pick a single value of Item this expression will return the Sales value of the next Item (in load order) from that selected. So you can have Item values like 1, 5,678,'Jabba the Hut' in your list box.

gerrycastellino
Contributor III

Re: How do I structure my set analysis to get next item sum

a follow up question: I have a field as dual as below:

dual('2015-Q4',1) as Survey_Type,

I'm running into issues with this in my set:

Count({ < Survey_Type = {"$(=num(Survey_Type)+1)"} >}[Overall Sat])

Re: How do I structure my set analysis to get next item sum

What if you create another field like this:

LOAD Num(Survey_Type) as Num_Survey_Type;

LOAD dual('2015-Q4',1) as Survey_Type,

FROM....

Count({<Num_Survey_Type = {"$(=Num_Survey_Type + 1)"}>}[Overall Sat])

effinty2112
Honored Contributor

Re: How do I structure my set analysis to get next item sum

Try:

=sum({$<Survey_Type= {$(=FieldValue('Survey_Type', FieldIndex('Survey_Type',Only(Survey_Type))+1))}>}[Overall Sat])

If the values of Survey_Type are loaded in the correct order this may work for you.

gerrycastellino
Contributor III

Re: How do I structure my set analysis to get next item sum

That worked, but I need to display the 2015-Q4  in my list box as selector.

gerrycastellino
Contributor III

Re: How do I structure my set analysis to get next item sum

will use a pick(match)

Community Browser