Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Anku
Creator
Creator

SET EXPRESSION LOGIC

Hi all,

I have a table script which has 2 different computation logic:

1. Direct: Here, I can get values for respective names

2. Division: Names' value need to be calculated by dividing keys, here, I am getting issues.

Kindly suggest how to proceed here. Note: Script can't be amended.

Below is the sample input table & desired output:

Anku_1-1666501229678.png

Note: For ease I have shown values column in input though it is in fact table.

Thank you.

Labels (1)
1 Solution

Accepted Solutions
ckarras22
Partner - Creator
Partner - Creator

Hello,

 

Please use the code below

IF(COMP_LOGIC='DIVISION', NUM(AGGR(ABOVE(VALUE),COMP_LOGIC,NAME,VALUE)/AGGR(BELOW(VALUE),COMP_LOGIC,NAME,VALUE),'###%'),VALUE)

result.jpg

View solution in original post

2 Replies
ckarras22
Partner - Creator
Partner - Creator

Hello,

 

Please use the code below

IF(COMP_LOGIC='DIVISION', NUM(AGGR(ABOVE(VALUE),COMP_LOGIC,NAME,VALUE)/AGGR(BELOW(VALUE),COMP_LOGIC,NAME,VALUE),'###%'),VALUE)

result.jpg

Anku
Creator
Creator
Author

Thanks @ckarras22 , no doubt above expression is working as expected to the dataset given however just an amd required (which is in point 2).

I need your help for:

1.  My "value" column is a set expression, still they will work inside agg(above(sum({$<conditions>}Values)….

2. The dataset actually has Num,Denom values instead of division (as I was thinking "Key" column is more imp), refer below:

Anku_0-1666529561944.png

3. Query: Name F is  a outcome of keys calculation ie 12/11 & Name G itself is key 11. So,  I think calculation made using keys will be more helpful,  what are your thoughts?

Thank you.