Search code examples
sqlaveragepowerbi-desktophaving

averaging parameter over groups excluding small ones in power bi


How do I achieve the equivalent of the following SQL in power bi?

Select jobtype,avg(salary) from staff group by jobtype having count(*)>3

Solution

  • Try this:

    1. Create a table visualization
    2. Drag 'jobtype' and 'salary' to the values section
    3. Drag 'jobtype' again so you have two of these fields
    4. Do a summarize by 'avg' by clicking the 'salary' field in the values section, this will give you the average salary.
    5. Do a summarize by 'count' by clicking one of the 'jobtype' fields in the values section, this will give you the counts.
    6. In the filters section, you'll see your 'count of job type' field. Click into this field and filter by the condition 'greater than 3'.

    Let me know if this was helpful.