Can I count_distinct within transactionize groupings?

Comments

5 comments

  • Avatar
    Mario Sanchez

    David, I believe your issue might be that you do not need a merge for your query, so your subquery can be your count_distinct.

    Without knowing your data, so making some assumptions, I believe what you are looking for is:

    "GET /api/transaction/" 
    | parse "GET /api/transaction/*?deviceid=* " as FieldA, FieldB
    |transactionize FieldA, FieldB (count_distinct(FieldB))

    Hope this helps!

    Cheers,

    Mario

    0
    Comment actions Permalink
  • Avatar
    david.kirby
    Thanks Mario, that worked! Just wondering how I can add fields from the log entries that are picked up by the query to the aggregates tab? ( I am new to sumo obviously)
    0
    Comment actions Permalink
  • Avatar
    david.kirby
    this is my current query: "GET /api/transaction/" | parse "GET /api/transaction/*?deviceid=* " as FieldA, FieldB |transactionize FieldA, FieldB (count_distinct(FieldB)) | where _count_distinct > 1 Which yields a nice little table on the Aggregates tab that looks something like this: # _count_distinct 1 2
    0
    Comment actions Permalink
  • Avatar
    david.kirby
    Got it displaying the way I wanted using a group by call, so: |transactionize FieldA, FieldB (count_distinct(FieldB) group by FieldA) | where _count_distinct > 1
    0
    Comment actions Permalink
  • Avatar
    david.kirby
    Thanks again @Mario S nchez
    0
    Comment actions Permalink

Please sign in to leave a comment.