Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
I'm having some issues in trying to work out how to remove duplicate rows from a calculation.
I have the following dataset (highly simplified from actual)
KEY | NAME | JOB | PAYMENT |
Bill|100 | Bill | Electrician | 100 |
Bill|100 | Bill | Plumber | 100 |
Jenny|200 | Jenny | Electrician | 200 |
Simon|500 | Simon | Plumber | 500 |
Simon|500 | Simon | Gardner | 500 |
The issue is that the system the data imports from the payment calculation is for the total of all jobs carried out by that person. For example, Bill did work as an Electrician and a Plumber but was only paid a total of 100 for both not the summation of both job payments.
To attempt to filter out these duplications, I have created concatenated keys so that I should be able to filter the duplicates and sum all payments without double counting. So in the example above the total payments made to all workers should only be 800 but I can't seem to get the DAX right to remove the duplications. Can anyone assist please?
Thanks,
John
Solved! Go to Solution.
OK, try this:
Measure = SUMX(SUMMARIZE(DistinctSum,[KEY],"Payment",AVERAGE(DistinctSum[PAYMENT])),[Payment])
What about removing the duplicates in Power Query instead?
In DAX, I would use SUMX with a DISTINCT:
https://msdn.microsoft.com/en-us/library/ee634943.aspx
Measure = SUMX(FILTER(Table,DISTINCT(Table[KEY])),Table[PAYMENT])
Thanks @Greg_Deckler.
I had thought along the same lines, but for some reason in trying this formula I get the "A table of multiple values was supplied where a single value was expected" error.
I think this is because when passing the DISTINCT there's no condition applied to provide a boolean value for FILTER to use.
As far as using Power Query to remove the duplicates, unfortunately, I need the other detail for other calculations. e.g. In this example show total paid to Plumbers.
Not sure, I recreated your table exactly, can you post your formula?
I think this is because when passing the DISTINCT there's no condition applied to provide a boolean value for FILTER to use.
OK, try this:
Measure = SUMX(SUMMARIZE(DistinctSum,[KEY],"Payment",AVERAGE(DistinctSum[PAYMENT])),[Payment])
@Greg_Deckler This seems like a working answer for an issue i'm having except i dont see the option for "DistinctSum". My data structured like this:
Order Number | Hours
123544 | 2
123544 | 2
178113 | 1
199911 | 5
I would like to remove the duplicate 123544 from my sum to see 8 as the total instead of 10.
Hi @johnf
Another way of doing it
Go to Modelling Tab >>>NEW TABLE and use this formula
New Table = SUMMARIZE ( TableName, TableName[NAME], "Job", CONCATENATEX ( TableName, TableName[JOB], "," ), "Payment", AVERAGE ( TableName[PAYMENT] ) )
(With your sample data)
HI,
I tried to make your stuff, but i dont know why, it's did the average of the whole column.
i have in the first table some times but some are for the same merged cells. In the second column i did the sum betwin cells which have the same indicator (merged) so in the list there is for example
12 12 Q125
15 27 Q158
14 14 Q789
12 27 Q158
14 14 Q963
And I need to have just
12 12 Q125
15 27 Q158
14 14 Q789
14 14 Q963
New Table = SUMMARIZE ( Table_owssvr4; Table_owssvr4[Merged.1]; "total fg "; AVERAGE ( 'Table 4'[total tempo FG]) )
Can you help me?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
133 | |
76 | |
53 | |
38 | |
37 |
User | Count |
---|---|
202 | |
80 | |
71 | |
55 | |
48 |