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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.