Use count by with multiple where clauses

Comments

2 comments

  • Avatar
    Kevin Keech

    Hi Marc,

    I believe what you'll need to do something like the following. 

    | if (timetaken > 750, 1, 0) as greaterthan_750
    | if (timetaken <= 750, 1, 0) as lessthanequal_750
    | sum(greaterthan_750) as greaterthan_750, sum(lessthanequal_750) as lessthanequal_750 by _timeslice

    This will look for the timetaken value and generate a new column with a 1 or 0 depending on the value. Then we just sum up the values for each of these columns to get your two results by timeslice. 

  • Avatar
    Marc Powell

    You're absolutely right, why didn't I think of that?! Thanks for the help, Kevin

Please sign in to leave a comment.