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: 
musketeers
Creator
Creator

need to get sum across dimension

Hi, I have a table where I have let say 3 columns. Product_Name, Test_Result, Error_Code. Example:

Product_NameTest_resultError_Code
P1PASS 
P2PASS 
P3PASS 
P4FAIL1
P5FAIL1
P6FAIL2
P7FAIL3
P8FAIL2
P9FAIL3
P10FAIL1

I need to create a table chart where dimension in Test_Result and measure is count of test_result.

The issue is:

requirement is that when user select any error code let say error code = 2, all the other error code should be considered as pass. so in case when error code 2 is selected, Fail count is 2 and pass count is 8

for me 'fail' dimension is fine. But for dimension value 'Pass', i am unable to produce 8. could you please help me to acheive this.

Load script for the above dummy data is:

LOAD * Inline [

Product_Name , Test_result , Error_Code
P1, PASS,
P2, PASS,
P3, PASS,
P4, FAIL, 1
P5, FAIL, 1
P6, FAIL, 2
P7, FAIL, 3
P8, FAIL, 2
P9, FAIL, 3
P10, FAIL, 1
];

Labels (3)
1 Solution

Accepted Solutions
Daniel_Castella
Support
Support

Hi @musketeers 

 

Try a table with the following dimension and measure:

Dimension: 

If(GetSelectedCount(Error_Code)<>1, Test_result, if(Error_Code=GetFieldSelections(Error_Code),'FAIL','PASS'))

 

Measure:

Count({<Error_Code= >}Test_result)

 

It seems to work for me:

Captura de pantalla 2026-04-01 125929.png

 

Kind Regards

Daniel

View solution in original post

2 Replies
marcus_sommer
MVP
MVP

At first I would try to create a view for the wanted information without the dimension "Test_result" by using two expressions, like:

count({< Error_Code = p(Error_Code)>} Test_result)
count({< Error_Code = e(Error_Code)>} Test_result)

If this isn't feasible a next step may go to create a calculated dimension, like:

valuelist('PASS', 'FAIL')

and then assigning the above shown expressions to the values, for example:

pick(match(valuelist('PASS', 'FAIL'), 'PASS', 'FAIL'),
   count({< Error_Code = e(Error_Code)>} Test_result),
   count({< Error_Code = p(Error_Code)>} Test_result)) 

Daniel_Castella
Support
Support

Hi @musketeers 

 

Try a table with the following dimension and measure:

Dimension: 

If(GetSelectedCount(Error_Code)<>1, Test_result, if(Error_Code=GetFieldSelections(Error_Code),'FAIL','PASS'))

 

Measure:

Count({<Error_Code= >}Test_result)

 

It seems to work for me:

Captura de pantalla 2026-04-01 125929.png

 

Kind Regards

Daniel