Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

prachi_s_patkar
New 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

Re: KPI Calculating wrong value

Maybe try Set Analysis.

Below typed freehand, so may have typo's :

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

5 Replies

Re: KPI Calculating wrong value

Maybe try Set Analysis.

Below typed freehand, so may have typo's :

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

prachi_s_patkar
New Contributor II

Re: KPI Calculating wrong value

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.

Re: KPI Calculating wrong value

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.

Re: KPI Calculating wrong value

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
New Contributor II

Re: KPI Calculating wrong value

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

Community Browser