Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to count the number of Parameters when calculating values for each shift. The same value is repeated for 2 shifts.
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)) ))
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
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