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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Giansonn
Creator
Creator

Dynamic measure label in chart using aggr

I am trying to create a dynamic label that shows stock added on a certain date.

Normally I have a single column but now I have broken up my stock added into 4 rows so it looks like this:

STR 3.PNG

What I would like to do is add a second row label that is the sum of these row labels so that I only have row for each column, something like this:

STR 4.PNG

I believe that the formula is something like this but I can't quite get it right:

=aggr(rangesum(above(stock_added)),measure1,measure2)

6 Replies
sunny_talwar

I am not sure as to what exactly are you looking to achieve... would you be able to elaborate with an example?

Giansonn
Creator
Creator
Author

I have also tried this:

 

=sum({<stock_week= {"(stock_week)"}>} total stock_added)

 

I don not believe that the total function works very well with set expressions...

Giansonn
Creator
Creator
Author

I am trying to add another column that lists the stock added as an extra column. Adding it as a row used to be the cheeky way around the issue because there was only one entry however now I have 4 entries (by two dimensions) and aggregation formulas are not allowed except aggr. for row since rows only accept dimensions.

Giansonn
Creator
Creator
Author

i.e. I want to use a measure as a row dimension

sunny_talwar

I don't think I understand, would you be able to share a sample to look at and may be share the expected output in an Excel file. 

Giansonn
Creator
Creator
Author

Yea sure,

 

stock weekstock addedsale_week 1sale_week 2sale_week 3
06/01/2020?x1y1z1
11/01/2020?x2y2z2
16/01/2020?x3y3z3
21/01/2020?x4y4z4
26/01/2020?x5y5z5
31/01/2020?x6y6z6

 

Now I know that this should be a simple sum(total var) calculation but I cannot get the set expression to work. I know that in the second column if I do stock week I get the exact same result as in the first column, but when I do this total expression my expression returns zero:

 

=sum({<stock_week={"stock_week"}>} total stock_added)