Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Can anybody help me with this:
Sum the unique values in column "B" to the appropriate value in column "A".
Thank you,
Jan
Solved! Go to Solution.
@Kopec - You can use the below to get your desired answer (just change the column names):
VAR _table = SUMMARIZE( 'Table', 'Table'[Column1], 'Table'[Column2] )
RETURN
SUMX( _table, 'Table'[Column2])
If this works for you please accept as the solution to help others with the same challenge.
Hi @Kopec
The formula i offered can work in power pivot.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Mark,
ist look great, but I need to get value for every row in the table. According to the picture (column "RESULT"):
Hi,
Thanks for the solution mark_endicott and DataNinja777 offered, and i want to offer some more information for user to refer to.
hello @Kopec , mark_endicott 's solution is right, you can use it as a calculated column .
Column =
VAR a =
SUMMARIZE ( 'Table', [Column1], [Column2] )
RETURN
SUMX ( FILTER ( a, [Column1] = EARLIER ( 'Table'[Column1] ) ), [Column2] )
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
for Power BI it works great.
Can anybody help me how to make it work in Power Pivot?
And can anybody know, why the below formula doesnt work?
=CALCULATE (SUMX(TABLE; Column B);VALUES(Column B); ALLEXCEPT(TABLE; Column A)
)
Hi @Kopec
The formula i offered can work in power pivot.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-xinruzhu-msft - Thank you, I always forget about calculated columns! Can I request we mark my solution please as this one is solved!
@Kopec - As far as I'm aware this will be nearly impossible in a measure due to the way Power BI groups identical rows in it's visualisations. Even if you add an index column to undo the grouping, there will still be an issue with the way we have to use SUMMARIZE to remove the row duplication to get the result you want.
There may be a solution out there for you but I've tried a few, including adding a duplicate of the table, and none seem to work.
I suggest you think about why it is necessary to present your data in this way, and if the solution I have provided works, or use Excel.
Hi @Kopec ,
You can achieve this in Power BI using DAX with a measure that sums the unique values of Column B for each corresponding value in Column A. The following DAX measure accomplishes this:
Result =
SUMX (
VALUES ( 'Table'[Column B] ),
'Table'[Column B]
)
This measure works by extracting the unique values in Column B for each group in Column A using VALUES('Table'[Column B]), then iterating over these unique values and summing them with SUMX(...). If you prefer to do this transformation in Power Query, you would first remove duplicates from Column B while keeping only unique values for each group in Column A. Then, you would group by Column A and sum the unique values in Column B. Finally, merge this result back to the original table to display the calculated sum in a new column.
Best regards,
It's almost done, but I need:
SUMX (
VALUES ( 'Table'[Column B] ),
'Table'[Column A]
)
In Column "A" is string.... I have got a mistake. I suppose because of that STRING values in Column A.
Can you help me?
@Kopec - You can use the below to get your desired answer (just change the column names):
VAR _table = SUMMARIZE( 'Table', 'Table'[Column1], 'Table'[Column2] )
RETURN
SUMX( _table, 'Table'[Column2])
If this works for you please accept as the solution to help others with the same challenge.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
25 | |
12 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
16 | |
14 | |
11 | |
11 |