Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
santharubban
Creator III
Creator III

Count the values

I need to distinct count for values. 10 different column each colunm has its own value, if col 1 value and any col have same value then it should be counted as distinct. example pls referre the attachement.

5 Replies
Gysbert_Wassenaar

Maybe like this:

count(distinct valuelist($(=concat(DIAG_01_CD,',') & ',' & $(=concat(DIAG_02_CD,',')  & ',' & $(=concat(DIAG_03_CD,',') & ',' & $(=concat(DIAG_04_CD,',') & ',' & $(=concat(DIAG_05_CD,',') & ',' & $(=concat(DIAG_06_CD,',') & ',' & $(=concat(DIAG_07_CD,',') & ',' & $(=concat(DIAG_08_CD,',') & ',' & $(=concat(DIAG_09_CD,',') & ',' & $(=concat(DIAG_10_CD,',') ))

Or perhaps you should use the Crosstable function to transform the data first into a format that is easier to work with.


talk is cheap, supply exceeds demand
santharubban
Creator III
Creator III
Author

thanks for reply can you explain the crosstable function please.

Gysbert_Wassenaar

See The Crosstable Load


talk is cheap, supply exceeds demand
santharubban
Creator III
Creator III
Author

i need distinct value for 10 columns

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this in script

Data:

CrossTable(Field, Value)

LOAD

  RecNo() AS RowNo,

  Field1,

  Field2,

  Field3

INLINE [   

    Field1, Field2, Field3

    8052, 9000, 2000

    1000, 2000, 8052

    9000, 8052, 1000

];

Now in expression try like this

=Sum(Aggr(If(Count(Value) > 1,1), Value))

Regards,

Jagan.