cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Dax for sum of distinct values grouped by multiple columns

Hi community,

 

Following is my sample dataset, I want to add a column "Total Sal"(already added in the following snapshot) that is total of distinct salaries of employees. Grouped by Dept, position,empcode.


distinct sum.PNG

 

 

 

 

 

 

I have tried few DAX, but nothing is working.

Your help is much appretiated.

Many thanks,

Meena

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resolver II
Resolver II

Re: Dax for sum of distinct values grouped by multiple columns

Another community member could probably improve on this, but I did this by changing the grain of the table, i.e. removing the qualification column and consolidating the duplicates. You can do this in a separate table by referencing the query in Query Editor.

Then you can add in the measure:

Total Departmental Salary =
CALCULATE ( SUM ( Salaries[Salary] ), ALLEXCEPT ( Salaries, Salaries[Dept] ) )

 

View solution in original post

2 REPLIES 2
Highlighted
Resolver II
Resolver II

Re: Dax for sum of distinct values grouped by multiple columns

Another community member could probably improve on this, but I did this by changing the grain of the table, i.e. removing the qualification column and consolidating the duplicates. You can do this in a separate table by referencing the query in Query Editor.

Then you can add in the measure:

Total Departmental Salary =
CALCULATE ( SUM ( Salaries[Salary] ), ALLEXCEPT ( Salaries, Salaries[Dept] ) )

 

View solution in original post

Highlighted
Helper I
Helper I

Re: Dax for sum of distinct values grouped by multiple columns

Table =
SUMMARIZE (
    EmpSalary,
    EmpSalary[Dept],
    EmpSalary[empcode],
    EmpSalary[Position],
    "TotalSal", DISTINCT ( EmpSalary[salary] )
)

Hai Meena.,

Please try this....

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors