Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Eshwar1
Contributor II
Contributor II

Calculated fields and Percentage value buckets

Hi All,

I need to create 4 different line charts using 4 diff calculated fields  

Dim: Fully_Engaged%

Measure: Count(Branch_Code)

one able to achieve it with using below script

//To create percentage value buckets

Temp_Min_Max:
Load * Inline
[
Min, Max,     Code
0.0%, 10.0%, 10.0%
10.1%,15.0%, 15.0%
15.1%,20.0%, 20.0%
20.1%,25.0%, 25.0%
25.1%,30.0%, 30.0%
30.1%,35.0%, 35.0%
35.1%,40.0%, 40.0%
40.1%,45.0%, 45.0%
45.1%,50.0%, 50.0%
50.1%,55.0%, 55.0%
55.1%,60.0%, 60.0%
60.1%,65.0%, 65.0%
65.1%,70.0%, 70.0%
70.1%,75.0%, 75.0%
75.1%,80.0%, 80.0%
80.1%,85.0%, 85.0%
85.1%,90.0%, 90.0%
90.1%,95.0%, 95.0%
95.1%,100.0%,100.0%

];

 

Data:
Load Branch_code,
Num(Sum(if(Segment='Fully Engaged', Cust_Cnt,0))/Sum(Cust_Cnt),'#,##0.0%') as Fully_Engaged%

Resident Temp

group by Branch_code;

 

Inner join(Temp_Min_Max)
IntervalMatch(Fully_Engaged%)
Load Min,
        Max
Resident Temp_Min_Max;

above total script is working fine as expected.

But i need to create 3 more calculated fields like, Wealth_Engaged% , Trans_Engaged% and Low_Engaged%

and associate Percentages value buckets to it (not able to achieve this)

can you suggest how to write the script for to achieve it.

Thanks in advance

-Eshwar

 

Labels (4)
1 Solution

Accepted Solutions
marcus_sommer

You don't need an intervalmatch + join approach for such simple cluster else you could derive it with a rounding, like:

num(
rangemax(0.1,
   ceil(
     sum({< Segment = {'Fully Engaged'}>} Cust_Cnt) / sum(Cust_Cnt),
   0.05)
),
'0.0%')

in an example how it might be calculated as expression within the UI. If it really needs to be a dimension it might be wrapped with an aggr(Expression, Branch_code).

If it should be really native fields and the cluster-sizes are more irregular I would use a mapping with something like:

m: mapping load Min + (iterno() / 100), Code
     from X while Min + (iterno() / 100) < Max;

and then wrapping the percent-calculation with an applymap() whereby the lookup-value should be rounded to the pattern of the mapping-values.

View solution in original post

2 Replies
marcus_sommer

You don't need an intervalmatch + join approach for such simple cluster else you could derive it with a rounding, like:

num(
rangemax(0.1,
   ceil(
     sum({< Segment = {'Fully Engaged'}>} Cust_Cnt) / sum(Cust_Cnt),
   0.05)
),
'0.0%')

in an example how it might be calculated as expression within the UI. If it really needs to be a dimension it might be wrapped with an aggr(Expression, Branch_code).

If it should be really native fields and the cluster-sizes are more irregular I would use a mapping with something like:

m: mapping load Min + (iterno() / 100), Code
     from X while Min + (iterno() / 100) < Max;

and then wrapping the percent-calculation with an applymap() whereby the lookup-value should be rounded to the pattern of the mapping-values.

Eshwar1
Contributor II
Contributor II
Author

Thank you very much @marcus_sommer 

your below expression is working as i expected

num(
rangemax(0.1,
   ceil(
     sum({< Segment = {'Fully Engaged'}>} Cust_Cnt) / sum(Cust_Cnt),
   0.05)
),
'0.0%')

 

didn't try to use mapping load one , will try to use that also.