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: 
wttaryde
Contributor III
Contributor III

Dynamic Label for Measure in Bar Chart

I need to have dynamic labels in the legend for my stacked bar chart.

Example data:

Company, Qnum, Response, Subtext
Albertsons, BL5.1, 1123, Mail
Albertsons, BL5.2, 12345, Internet
Safeway, BL5.1, 12345, Mail
Safeway, BL5.2, 123455, Internet

My measure expressions are:

Sum({$<Qnum={"BL5.1"}>}Response)
Sum({$<Qnum={"BL5.2"}>}Response)

resulting in stacked bar

Right now my label for each measure is just text: "Mail" or "Internet". 

I'd like my label to automatically populate so that when the measure uses BL5.1 my label = Mail; for BL5.2 my label = Internet; without me having to type the label.

An IF statement would be something like: =IF(Qnum ='BL5.1',Subtext,null())

Qlik Sense likes that expression, but returns "-" in the legend. So it's not evaluating it correctly.  I don't know how to write the expression to get the desired result.

Thanks

1 Solution

Accepted Solutions
wttaryde
Contributor III
Contributor III
Author

Found the solution on another post:

=Aggr([Subtext Alias (row)],Qnum='BL5.1')

View solution in original post

1 Reply
wttaryde
Contributor III
Contributor III
Author

Found the solution on another post:

=Aggr([Subtext Alias (row)],Qnum='BL5.1')