Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
o59393
Post Prodigy
Post Prodigy

How to sum distinct values only

Hi all

 

I am trying to sum only distinct values for the column "units" where the combination is the same for month+code+city

 

As seen for example:

 

3432344234cg.JPG

 

In the image above it should only sum 35,661 once.

 

I tried this dax but unsuccesful result:

 

 

Sum RE distinct = 

SUMX(
SUMMARIZE(Sheet1,Sheet1[Code],Sheet1[City],Sheet1[Month]),
MAX(Sheet1[Units])
)

 

 

Result should be:

 

lsadlk2.JPG

 

https://1drv.ms/u/s!ApgeWwGTKtFdhyxvwe8MeK5wIhZ0?e=CfKDy4

 

How can I get it right?

 

Thanks.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@o59393 , a new measure

sumx(summarize(Table,Table[month],Table[code],Table[city],Table[unit]),[unit])

 

or your formula like

Sum RE distinct = 

SUMX(
SUMMARIZE(Sheet1,Sheet1[Code],Sheet1[City],Sheet1[Month],"_1",MAX(Sheet1[Units])),
[_1]
)

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@o59393 , a new measure

sumx(summarize(Table,Table[month],Table[code],Table[city],Table[unit]),[unit])

 

or your formula like

Sum RE distinct = 

SUMX(
SUMMARIZE(Sheet1,Sheet1[Code],Sheet1[City],Sheet1[Month],"_1",MAX(Sheet1[Units])),
[_1]
)

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Can some one explain why this works? 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.