Are there in group by operators for String fields

Comments

6 comments

  • Official comment
    Avatar
    Jorge Silva

    To group by market_name as well as fruit, the "avg" operator line would be like this:

    | avg(price) as "avg_price" by fruit, market_name

    Give this a try and let me know if any questions.

    Comment actions Permalink
  • Avatar
    Shanmukhanand Naikwade
    rownum fruit market_name avg price
    1 apple m1
    m2
    m3
    2
    2 orange m2
    m3
    2
    0
    Comment actions Permalink
  • Avatar
    Shanmukhanand Naikwade

    So the query would be something like 

    | avg(price) as "avg_price" by fruit. 

    But is there a way i can get market_name in the query result as well?

    In splunk, the query would look like 
    | stats avg(price), values(market_name) as market_name by fruit

    0
    Comment actions Permalink
  • Avatar
    Shanmukhanand Naikwade

    Hi Jorge,

    No, it does not meet the requirements. I do not want market_name in my group by fields. 

     

    If i use the query you provided, it will give me the result like - 

    Fruit Market_name price
    apple m1 2
    apple m2 3
    apple m3 1
    orange m2 3
    orange m3 1

    Which is average price per fruit and market_name. I do not want this. 

     

    I want average price per fruit only but i also want to see all unique values for market_name in the final result

    0
    Comment actions Permalink
  • Avatar
    Jorge Silva

    Let's move this conversation to the ticket you open with support.

    0
    Comment actions Permalink
  • Avatar
    Shanmukhanand Naikwade

    There is an idea posted on sumo. 

    I would encourage all of you who visit this post to vote the idea. 

    0
    Comment actions Permalink

Please sign in to leave a comment.