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: 
TNAM
Partner - Contributor
Partner - Contributor

Using Aggr() in Histogram Dimension

Hello, 

I'm having trouble with creating a calculated dimension for a histogram in Qliksense. 

As shown in the image below,  I was hoping to create a set of ranges on the x-axis : 0%, 1~5%, 6~10%, 11~15%, etc. However, for some reason, the chart will not generate 1~5%  range and instead, those data points are grouped with 0%.  For instance, the value of 0.05 will be grouped into 0% (as shown in the image below in Aggr Expr - Dimension column). Funny thing is that when I put the same expression as a measure (Aggr Expr - Measure), it seems to be working fine.  
What could be happening here? 

TNAM_0-1605368452839.png

 

TNAM_1-1605302980938.png

This is the expression I used to calculate those ranges:


=aggr(
   if(
          only({$} TEST_PERCENTAGE) = 0, dual('0%', 0)
          , dual(
                 num((div(only({$} TEST_PERCENTAGE) - 0.01, 0.05) * 5) + 1, '###0') & '-' & num((div(only({$}                                           TEST_PERCENTAGE) -  0.01, 0.05) + 1) * 0.05, '###0%')
             ,  div(only({$} TEST_PERCENTAGE) - 0.01, 0.05
          )
       )
    ), TEST_PERCENTAGE
)

 

TEST_PERCENTAGE values contain test percentages in decimals (e.g. from 0.05 to 0.80)

 

 

Labels (1)
0 Replies