Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I have a table that follows this structure:
Code | Level | Total |
111 | A | 1 |
111 | A | 1 |
222 | B | 1 |
333 | B | 2 |
333 | B | 1 |
111 | C | 1 |
222 | D | 1 |
444 | D | 2 |
As you can see, the same "Level" can have more than one distinct "Code".
I want to create a measure that sums the "Total" column only if the "Level" is repeated for more than one distinct "Code".
So I wanted a way to know the sum of the "Total" column for each "Level" that is repeated in distinct Codes.
Based on the table above, this measure would bring me the following sum for each Level:
A = 0
B = 4
C = 0
D = 3
Solved! Go to Solution.
Try this:
MeasureTotal =
VAR __table = SUMMARIZE(Table2,Table2[Code],Table2[Level],"count",DISTINCTCOUNT(Table2[Code]),"sum",sum(Table2[Total]))
VAR _table2 = SUMMARIZE(__table,Table2[Level],"countCode",sumx(__table,[count]),"sumtotal",sumx(__table,[sum]))
RETURN IF(sumx(_table2,[countCode])>1,sumx(_table2,[sumtotal]),0)
Proud to be a Super User!
Try this:
MeasureTotal =
VAR __table = SUMMARIZE(Table2,Table2[Code],Table2[Level],"count",DISTINCTCOUNT(Table2[Code]),"sum",sum(Table2[Total]))
VAR _table2 = SUMMARIZE(__table,Table2[Level],"countCode",sumx(__table,[count]),"sumtotal",sumx(__table,[sum]))
RETURN IF(sumx(_table2,[countCode])>1,sumx(_table2,[sumtotal]),0)
Proud to be a Super User!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
72 | |
70 | |
37 | |
29 | |
26 |
User | Count |
---|---|
91 | |
49 | |
45 | |
38 | |
37 |