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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

Load * inline

Hi All,

I have written code in edit script as

Threshold:

LOAD * INLINE

[

   Threshold, ThresholdCode

   <50K, 1

   >50K, 2

   >100K, 4

   >250K, 8

   >500K, 16

];

In the front end i am displaying as

t.PNG

Now i need to display one more field called "All" which calcuates all i.e. <50K to >500K.

Can you please tell me how to achieve this.

Thanks,

Bharat

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Not sure if I got you right. I still find it a simple case of Sum(ThresholdCode) expression with selection.

Untitled.png

View solution in original post

9 Replies
avinashelite

Try like this :

Temp:

LOAD * INLINE

[

   Th, Tc

   All-<50K, 1

   All->50K, 2

   All->100K, 4

   All->250K, 8

   All->500K, 16

];

Threshold:

LOAD subfield(Th,'-') as Threshold,

ThresholdCode

resident

Temp;

drop table Temp;

tresesco
MVP
MVP

try like:

LOAD * INLINE

[

   Threshold, ThresholdCode

   <50K, 1

   >50K, 2

   >100K, 4

   >250K, 8

   >500K, 16

  All, 1

   All, 2

   All, 4

   All, 8

   All, 16

];

This is the basic concept, you could do it differently for big tables by loading the same table once again and concatenating it, with 'All' as value for all records.

bharatkishore
Creator III
Creator III
Author

HI Tresesco,

Thanks a lot for the reply.

With your code i am able to display "All".

The only thing i need to know is

Will this calculate <50K+>50K+>100K+>250K+>500K

tresesco
MVP
MVP

Yes. Try and let know if it doesn't.

bharatkishore
Creator III
Creator III
Author

I have given expression in chart as(in Expression Tab)

=if(1= (SUM(ThresholdCode) bitand 1),

  if(SUM([LC2 Amount])<50000, SUM([LC2 Amount]), NULL()),

    

If(2 = (SUM(ThresholdCode) bitand 2),  //>50K

     if(SUM([LC2 Amount])>=50000 AND SUM([LC2 Amount])<100000, SUM([LC2 Amount]), NULL()),

If(4 = (SUM(ThresholdCode) bitand 4),  //>100K

     if(SUM([LC2 Amount])>=100000 AND SUM([LC2 Amount])<250000, SUM([LC2 Amount]), NULL()),

If(8 = (SUM(ThresholdCode) bitand 8),  //>250K

     if(SUM([LC2 Amount])>=250000 AND SUM([LC2 Amount])<500000, SUM([LC2 Amount]), NULL()),

If(16 = (SUM(ThresholdCode) bitand 16),  //>500K

     if(SUM([LC2 Amount])>=500000, SUM([LC2 Amount]), NULL()),

NULL())))))

Here also i need to include ALL. Can you please tell me how can i add "All" here.

tresesco
MVP
MVP

I am not sure if what you are doing is really needed. I guess the expression could be optimized. Could you post a sample data explaining your requirement?

bharatkishore
Creator III
Creator III
Author

The thing i needed is i need to display values like <50K, >50K,>100K,>250K,>500K in a list box so that if the user selects the chart should be changed as per the selection what we do in the list box.

For that i have written this code in backend

Threshold:

LOAD * INLINE

[

   Threshold, ThresholdCode

   <50K, 1

   >50K, 2

   >100K, 4

   >250K, 8

   >500K, 16

  ];

Now my requirement is i need to display "All" for which calculates the <50+>50... This selection should get reflected in the chart which you can see in the below app. For that i have written expression as

=if(1= (SUM(ThresholdCode) bitand 1),

  if(SUM([LC2 Amount])<50000, SUM([LC2 Amount]), NULL()),

  

If(2 = (SUM(ThresholdCode) bitand 2),  //>50K

     if(SUM([LC2 Amount])>=50000 AND SUM([LC2 Amount])<100000, SUM([LC2 Amount]), NULL()),

If(4 = (SUM(ThresholdCode) bitand 4),  //>100K

     if(SUM([LC2 Amount])>=100000 AND SUM([LC2 Amount])<250000, SUM([LC2 Amount]), NULL()),

If(8 = (SUM(ThresholdCode) bitand 8),  //>250K

     if(SUM([LC2 Amount])>=250000 AND SUM([LC2 Amount])<500000, SUM([LC2 Amount]), NULL()),

If(16 = (SUM(ThresholdCode) bitand 16),  //>500K

     if(SUM([LC2 Amount])>=500000, SUM([LC2 Amount]), NULL()),

NULL())))))

Now i need to add "All" calcuation here. Please suggest.

Thanks in advance..

tresesco
MVP
MVP

Not sure if I got you right. I still find it a simple case of Sum(ThresholdCode) expression with selection.

Untitled.png

bharatkishore
Creator III
Creator III
Author

Thanks a lot....