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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How to avoid double counting for Sums?

My data is like this in the underlying table: 

 

PBI_User_2023_0-1711724188411.png

My visual is like this: 

 

PBI_User_2023_1-1711724250079.png

 

When I show the total of Trx amount in a card for the visual, it shows 350 instead of 175. Because the underlying data has 2 distinct Project ID's for the same Person ID, it duplicates. How do I show the value in card appearing as 175? 

 

This example shows only 2 Project ID's but there can be multiple associated with Person ID. However the visual should show only the sum of amount that is in the display. I tried calculating distinctcount of Project IDs and tried dividing the regular sum of Amt by this distinct count. Doesn't work. 

 

Thank you! 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank @Ahmedx  for his prompt reply.

Hi @Anonymous  ,

Depending on the information you have provided, I created a sample data to help you solve your problem. You can follow these steps below.
Sample data:

vyifanwmsft_0-1711935337625.png

1.Add new measure.

Sum of Trx = 
VAR _PersonID =
    SELECTEDVALUE ( 'Table'[Person_ID] )
VAR _CountProj =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Proj_ID] ),
        FILTER ( 'Table', 'Table'[Person_ID] = _PersonID )
    )
RETURN
    DIVIDE ( SUM ( 'Table'[Trx] ), _CountProj )

 Final output:

vyifanwmsft_1-1711935379008.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thanks you both!! 

Anonymous
Not applicable

Thank @Ahmedx  for his prompt reply.

Hi @Anonymous  ,

Depending on the information you have provided, I created a sample data to help you solve your problem. You can follow these steps below.
Sample data:

vyifanwmsft_0-1711935337625.png

1.Add new measure.

Sum of Trx = 
VAR _PersonID =
    SELECTEDVALUE ( 'Table'[Person_ID] )
VAR _CountProj =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Proj_ID] ),
        FILTER ( 'Table', 'Table'[Person_ID] = _PersonID )
    )
RETURN
    DIVIDE ( SUM ( 'Table'[Trx] ), _CountProj )

 Final output:

vyifanwmsft_1-1711935379008.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you so much!! 

Ahmedx
Super User
Super User

you need to remove duplicates in power query or write to mayor using MAX

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors