Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Paknanarn23
Creator II
Creator II

Want to count the number of parameters

I want to count the number of Parameters when calculating values ​​for each shift. The same value is repeated for 2 shifts.

Paknanarn23_0-1726820283969.png


This is the code used to calculate the values ​​for each shift.

if(Shift='Morning',Count({<Shift={'Morning'},LH_Name={"PD*"},AD_Remark-={"*ok*","*ปกติ*","*down*"},AD_ApproveStatus-={"1"}>}DISTINCT AD_Remark),
if(Shift='Afternoon',Count({<Shift={'Afternoon'},LH_Name={"PD*"},AD_Remark-={"*ok*","*ปกติ*","*down*"},AD_ApproveStatus-={"1"}>}DISTINCT AD_Remark),
if(Shift='Night',Count({<Shift={'Night'},LH_Name={"PD*"},AD_Remark-={"*ok*","*ปกติ*","*down*"},AD_ApproveStatus-={"1"}>}DISTINCT AD_Remark)) ))

Labels (1)
2 Replies
p_verkooijen
Partner - Specialist II
Partner - Specialist II

Hi @Paknanarn23,

First of all, get rid of the if's and multiple calculations

This would result in the same output

COUNT({<Shift={'Morning', 'Afternoon', 'Night'}, LH_Name={"PD*"},AD_Remark-={"*ok*","*ปกติ*","*down*"},AD_ApproveStatus-={"1"}>}DISTINCT AD_Remark)

 

Based on the example there should be 2 values for AD_Remark in the Morning data

I would advice to create a chart with the dimensions you use in the Set Analysis 
So Shift, LH_Name, AD_Remark, AD_ApproveStatus
And as Expressions

  • COUNT(DISTINCT AD_Remark)
  • COUNT({<Shift={'Morning', 'Afternoon', 'Night'}, LH_Name={"PD*"},AD_Remark-={"*ok*","*ปกติ*","*down*"},AD_ApproveStatus-={"1"}>}DISTINCT AD_Remark)

    And check the remarks based on sele
avinashelite

Since you have Shift as a dimension and same condition for all the shifts : COUNT({<LH_Name={"PD*"},AD_Remark-={"*ok*","*ปกติ*","*down*"},AD_ApproveStatus-={"1"}>}Distinct AD_Remark)

should work