Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
You mean sum should be based on Type like 2+1+3 =6 for B1B2. If not i didnt get ur question
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
Try the following expression:
Sum({<MAKE=, MODEL=>} Distinct KW)
THANKS,
Narasimha
use below code
sum( distinct KW)
hope thiss helps
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)
Hi,
You can use TOTAL inside of sum function:
sum(TOTAL KW)
Thanks,
Niranjan M.