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: 
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

1 Solution

Accepted Solutions
swuehl
MVP
MVP

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
MVP
MVP

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