Departmentwise min,max salary and count or rows using powerbi

Tangirala DineshReddy 21 Reputation points
2021-07-20T17:13:03.197+00:00

I have table like below

116391-image.png

I want to display min(salary),max(Salary) and count(rows) by department wise like below using powerbi measures(Dax).

116386-image.png

note
not using group by in transform

  • note

**

Community Center | Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Lz._ 9,016 Reputation points
    2021-07-21T08:55:09.6+00:00

    @Tangirala DineshReddy

    In this Excel workbook 4 DAX Measures to get what you want:

    116610-demo.png

    Min_Eno

    =CALCULATE (  
        MIN ( Table1[eno] );  
        FILTER ( Table1; Table1[salary] = MIN ( Table1[salary] ) )  
    )  
    

    Min_Salary

    =CALCULATE (  
        MIN ( Table1[salary] );  
        FILTER ( Table1; Table1[salary] = MIN ( Table1[salary] ) )  
    )  
    

    Max_Salary

    =CALCULATE (  
        MAX ( Table1[salary] );  
        FILTER ( Table1; Table1[salary] = MAX ( Table1[salary] ) )  
    )  
    

    Count_Rows

    =COUNTROWS(Table1)  
    

    Note: IMHO Min_Eno makes no sense at all from a business point of view. If, for the same [deptno], 2 (or more) Min_Salary equal - see my example with [deptno] = 2 - what's the point?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.