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.
I have a table with 3 columns.
Column A contains unique IDs to various projects.
Column B contains the revenue for each project.
Column C contains a category that means some projects in the table appear twice because they fit multiple categories.
I have inserted a Card onto the page which displays total revenue for all projects, which is summing the total of Column B. However because of column C several of these projects are listed twice and so their revenues are counted twice which is not what i want.
I want to calculate the sum of revenue for all unique projects. I do not want to delete rows with duplicate values as other areas of my report utilise these duplicate values so it's important they remain. I simply want to sum the revenues of Column B but leaving out values where duplicates of Column A are found. Similar to how I can use the 'Count (Disctinct)' feature for unique number, I'd like to find a similar 'Sum (Distinct)' option but as per the screenshot below this doesn't exist.
Solved! Go to Solution.
We can use SUMX over a GROUPBY that includes the right columns to get to what you are looking for.
Revenue Corrected =
SUMX (
GROUPBY ( YourTable,YourTable[Project ID], YourTable[Revenue]),
YourTable[Revenue]
)
This is not a new table and should not be added as a calculated column. It should be added as a measure and you would put the measure in your card. You just have to change the name of the table and the columns to match your data.
Thanks! It worked. Still not sure how the GroupBy function works exactly but it does the job. Will continue the googling to understand 😄
We can use SUMX over a GROUPBY that includes the right columns to get to what you are looking for.
Revenue Corrected =
SUMX (
GROUPBY ( YourTable,YourTable[Project ID], YourTable[Revenue]),
YourTable[Revenue]
)
Many thanks @jdbuchanan71 for the quick response. I should clarify I don't have or need a table in my report. It is just a Card.
I've added a new column in the imported table field and copied your code but replacing with the relevant column names for ID, revenue. I just get the same huge revenue number in every row of the column (tens of $billions). Note even when I sum all values including duplicates I get abour $1Billion. As I don't know how the GROUPBY function works (a quick google doesn't give straightforward results) any further ideas?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
72 | |
62 | |
51 | |
48 |
User | Count |
---|---|
206 | |
90 | |
61 | |
59 | |
57 |