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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
gandalfgray
Specialist II
Specialist II

set analysis w implicit field values

Hi

This is the data:

LOAD * INLINE [

    item_id, group_id, stock

    A, 1, 16

    B, 1, 42

    C, 2, 14

    D, 2, 22

    E, 3, 13

];

What is the set expression syntax that will let you show the sum(stock) of the group_id for the selected item_id?

If you select any item_id the chart should show the possible group_ids and the sum(stock),

ie

selecting A should give:

group_id  sum(stock)

1             58

selecting D should give:

group_id  sum(stock)

2             36

selecting B and E should give:

group_id  sum(stock)

1             58

3             13

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Create a straight table chart with dimension group_id and as expression use:

=sum({<group_id=p(group_id), item_id>} stock)

View solution in original post

2 Replies
swuehl
Champion III
Champion III

Create a straight table chart with dimension group_id and as expression use:

=sum({<group_id=p(group_id), item_id>} stock)

gandalfgray
Specialist II
Specialist II
Author

Thanks!

I was trying with stuff like:

sum({<item_id=,group_id=P({1})>}stock)

but that did not gave my desired result.

Actually you can write the expression you suggested even shorter:

sum({<group_id=P(), item_id>}stock)

works