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
gabrielmission7
Frequent Visitor

Distinct Sum of Different IDs

Hello,

I have a table similar to the one below and want to get sums of the totals Hours left for all the activity codes; in this case, it should be 50 + 100 + 200 (350). However, I keep on getting 800 (50 + 50 + 100 + 200 + 200 + 200) even though I used DISTINCT function. 

Distinct Total Hours Left=
    SUMX(
        DISTINCT(
                'Event'[Activity Code]
            ),
        CALCULATE(SUM('Event[Hours Left]),
        'Event[Event Label] = "A")
    )
 
Thank you!

 

Table Event

Event IDEvent LabelActivity CodeHours Left
1A1050
2A1050
3A20100
4A30200
5A30200
6A30200

 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

4 REPLIES 4
Ahmedx
Super User
Super User

Screen Capture #1220.pngScreen Capture #1221.png

thank you so much @Ahmedx! That works! I also had my PBI upgraded to the latest release and was able to download the file. 

gabrielmission7
Frequent Visitor

Thank you so much @Ahmedx ! I'm running an older version of PBI desktop (Feb, 2023), and it's a company laptop so I can't upgrade it myself. I can't open the PBI file as a result. Would you be able to put the dax code here instead? Thanks a lot!

Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
https://1drv.ms/u/s!AiUZ0Ws7G26RiF0amyMHrQ2CP4Y3?e=0yXv9a

 

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.