Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
prachi_s_patkar
Contributor II
Contributor II

KPI Calculating wrong value

Hi,

I am new to Qlik Sense.

When I am using below calculation in table to show data, its working fine.

if(status='Submitting' OR status= 'Composing' OR status= 'Submitted' , OrderNumer)


Above calculation gives me list of Order numbers.  The result is correct here. Number of records are 33.

But same calculation when I am using in KPI to show that count,  I am not getting expected result.

Below is calculation I am using for KPI.   (Even without DISTINCT)

COUNT( DISTINCT if(status='Submitting' OR status= 'Composing' OR status= 'Submitted' , OrderNumer))


This gives me more count in some cases. like 80 or 82 which is wrong (with or without DISTINCT).

Is it due to any null value or something.

Please Help to handle this.

1 Solution

Accepted Solutions
Anonymous
Not applicable

Maybe try Set Analysis.

Below typed freehand, so may have typo's :

Count (  { < [status] = { 'Submitting' , 'Composing' , 'Submitted' } > } distinct [OrderNumber] )

View solution in original post

5 Replies
Anonymous
Not applicable

Maybe try Set Analysis.

Below typed freehand, so may have typo's :

Count (  { < [status] = { 'Submitting' , 'Composing' , 'Submitted' } > } distinct [OrderNumber] )

prachi_s_patkar
Contributor II
Contributor II
Author

Thanks a lot Bill..

Sorry for late reply.

working fine now with this set analysis.

but still thinking what is the difference,

In other KPI for same case, my previous calculation is giving exact result.

Anyways ... Thanks once again.

appreciate your quick response.

Anonymous
Not applicable

Hard to say without full visibility of your data and qvf.

But in general it is always better to use Set Analysis as it is a lot more efficient than If's, hence also best practice.

Glad you are on the road and it is working now.

sunny_talwar

Is status and OrderNumber coming from different tables in your back end data model? I have seen unexpected numbers when above is the case

prachi_s_patkar
Contributor II
Contributor II
Author

Its actually a two different tables from DB side but we have created View on top of it to use processed data in Qlik.