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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.