Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Montanarin
Contributor
Contributor

Count if (field is like field)

hi all,

i need to show a bar chart that counts the fault code, for example field (guasti) could be '19', of course it could contains many faults like ('23,19,15'). So i need count how many times each field is presents, itself or into a more complex strings.

 

see my sample below

 

thank you

1 Solution

Accepted Solutions
Kushal_Chawda

@Montanarin  script solution will go like below

Data:
LOAD guasti,
SubField(guasti,',') as guasti_all
FROM Table;

Then create a chart with Dimension guasti_all and measure count(guasti_all)

View solution in original post

5 Replies
Kushal_Chawda

@Montanarin  do you want to do it in script or front end?

Montanarin
Contributor
Contributor
Author

Hello Kush, i would like just to have a chart; of course if just Script solution can solve it, alright.

Kushal_Chawda

@Montanarin  If I understood it correctly. Do you need this?

Below is the data

Screenshot 2020-09-24 132136.png

Create chart with below dimension and measure

// Dimension
=ValueList($(=concat(DISTINCT guasti,',')))

//Measure
=SubStringCount(concat(DISTINCT total guasti,','),
ValueList($(=concat(DISTINCT guasti,','))))

 

Screenshot 2020-09-24 134205.png

Kushal_Chawda

@Montanarin  script solution will go like below

Data:
LOAD guasti,
SubField(guasti,',') as guasti_all
FROM Table;

Then create a chart with Dimension guasti_all and measure count(guasti_all)

Montanarin
Contributor
Contributor
Author

perfect... many thanks.

What about translate an "enum" to "guasti" number. i.e. 23 means "engine".