Moved to beastmode section

edited December 2022 in Charting

Sorry not sure how to remove a question so just deleted content as I added under wrong section. Now in "Beastmode" forum.




  • MichelleH

    @Katie_Forrest_2022 Your second beast mode is returning 0% because you are using a combination of OR and <> in you case statement, which is logically true for every row in your dataset. So for example, Discrepancy 121901 is not Discrepancy 121275, so it meets the criteria of your second exception.

    I generally prefer to use additional WHEN... THEN... clauses in case statements over OR operators because it allows you to be much more surgical about classifying rows. It's also helpful that WHEN... THEN... clauses are evaluated top to bottom, whereas the order does not matter with criteria separated by OR operators.

    I'd suggest structuring your beast mode like this:

    count(distinct case
     when `HOLD_NAME` in ('Discrepancy 121901','Discrepancy 121275', 'Discrepancy 121325','Discrepancy 121566')
       then `Study Number`
     when `HOLD_NAME` not in ('Incomplete Info' ,'PO – INVOICE HOLD', 'PENDING PO OVERRIDE' , 'CREDIT HOLD- INVOICE HOLD','CCCL Info Incomplete')
       and `HOLD_NAME` not like '%Discrepancy%'
       and `RETURNCODE` is not null   
       then `Study Number` 
    end) / count(distinct `Study Number`)