Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
manojkulkarni
Partner - Specialist II
Partner - Specialist II

Frequency of each value

HI Team,

I am trying to build an application which has to provide frequency or occurrence of each value for all the columns/fields in single chart.

I found some applications with the above requirement with single field selection. (App name :FieldObserver)

Any help is much appreciated.

1 Solution

Accepted Solutions
Not applicable

Hi Manoj,

Below is one way of calculating the frequency or occurrence of each value for all the columns/fields in single table chart.

Try this out, it may help you to continue further on the same.

let tablename='tablename';

Count:
load * inline [ColumnName,ColumnValue,ColumnCount];

for i=1 to NoOfFields('$(tablename)')
     
let vcolumnname=FieldName(i,'$(tablename)');   
     
concatenate (Count)
     
load
        '$(vcolumnname)'
as ColumnName,
       
$(vcolumnname) as ColumnValue,
       
count(1) as ColumnCount,
        1
as tmp  
     
resident $(tablename)
     
group by $(vcolumnname);
next i;

left join (Count)
load
      ColumnName
,
     
count(tmp) as distinct
resident Count
group by ColumnName;

drop Field tmp;

View solution in original post

1 Reply
Not applicable

Hi Manoj,

Below is one way of calculating the frequency or occurrence of each value for all the columns/fields in single table chart.

Try this out, it may help you to continue further on the same.

let tablename='tablename';

Count:
load * inline [ColumnName,ColumnValue,ColumnCount];

for i=1 to NoOfFields('$(tablename)')
     
let vcolumnname=FieldName(i,'$(tablename)');   
     
concatenate (Count)
     
load
        '$(vcolumnname)'
as ColumnName,
       
$(vcolumnname) as ColumnValue,
       
count(1) as ColumnCount,
        1
as tmp  
     
resident $(tablename)
     
group by $(vcolumnname);
next i;

left join (Count)
load
      ColumnName
,
     
count(tmp) as distinct
resident Count
group by ColumnName;

drop Field tmp;