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: 
Not applicable

Reg:Handling distinct Values

Hi All,

     I am having following data structure

   TYPE  MAKE  MODEL  KW

   A1A3  MAK1   MDU1    1

   A1A3  MAK1   MDU1    2

   A1A3  MAK1   MDU1    1

   B1B2  MAK2   MDU2    2

   B1B2  MAK2   MDU2    1

   B1B2  MAK2   MDU2    3

Now I want to show the sum of KW values irrespetive of Make/Model..Means I need to show distinct values of KW irrespetive of MAKE and Model

Actual O/P : SUM(KW)=10

Expected O/P:             =6

Note:

   Though it is having diffrent MAKES & MODELS need to get only distict KW values,in the straight table.

  

-Jai

Labels (1)
6 Replies
Not applicable
Author

You mean sum should be based on Type like 2+1+3 =6 for B1B2. If not i didnt get ur question

Not applicable
Author

Hi vikram,

               It should sum based on KW values not by make/model .So that as a distinct value 1 and 2 will come from

A1A3 and 3 from B1B2. It should neglect remaining occurance for the same.

Thanks,

Jai

Not applicable
Author

Try the following expression:

    Sum({<MAKE=, MODEL=>} Distinct KW)

THANKS,

Narasimha

SunilChauhan
Champion II
Champion II

use below code

sum( distinct KW)

hope thiss helps

Sunil Chauhan
jagannalla
Partner - Specialist III
Partner - Specialist III

If you want to do it in script. Use this code.

T3:

LOAD * INLINE [

       TYPE,  MAKE,  MODEL,  KW

       A1A3,  MAK1,   MDU1,    1

       A1A3,  MAK1,   MDU1,    2

       A1A3,  MAK1,   MDU1,    1

       B1B2,  MAK2,   MDU2,    2

       B1B2,  MAK2,   MDU2,    1

       B1B2,  MAK2,   MDU2,    3

];

R_T3:

LOAD KW, KW as Kvalue,Sum(KW) as Kvalue1

Resident T3

Group By KW;

-In ST take dim as TYPE and Exp as Sum(kValue)

Not applicable
Author

Hi,

You can use TOTAL inside of sum function:

sum(TOTAL KW)

Thanks,

Niranjan M.