Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Create a straight table chart with dimension group_id and as expression use:
=sum({<group_id=p(group_id), item_id>} stock)
Create a straight table chart with dimension group_id and as expression use:
=sum({<group_id=p(group_id), item_id>} stock)
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