Search code examples
distinctqlikviewqliksense

How do I count one value and then count distinct another one in Qlik


I am trying to count how many times all my machines stopped and then I want to count distinct and see how many machines have stopped. So how many times they stopped - and how many of the machines stopped

    count(DISTINCT MachineNumber if ({$<Program = {"DETECT    
    STOP"}>})MachineNumber)

Thanks!


Solution

  • You need 2 expressions

    Number of Machines: count({$<Program = {"DETECT STOP"}>} DISTINCT MachineNumber)

    Number of Stop Events: count({$<Program = {"DETECT STOP"}>} MachineNumber)