cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Frequent Visitor

## Power BI Measure - Summarize distinct values

I am trying to find the sum for defective effort but I need it to only sum distinct WorkItemId where Links.TargetWorkItem.WorkItemId is not blank

Measures I currently have:

Defective Effort =

For the Sum in the table below (and in the chart) I am wanting the total to be 31 not 35, The Effort for ID 10829 is Getting counted twice

Thanks for the help.  I have searched for a few hours and can not find one that is workign for me.

1 ACCEPTED SOLUTION
Community Support

Hi @Thumper369 ,

Here's the solution.

1.The dummy data I created.

2.Create a measure to calculate the Defective Effort.

``````Defective Effort =
CALCULATE (
SUM ( 'Work items with direct links'[Effort] ),
FILTER (
ALLSELECTED ( 'Work items with direct links' ),
[ID] = MAX ( 'Work items with direct links'[ID] )
)
)
``````

3.You can see that the total in the table is incorrect, so we just need to create a new measure to add them correctly.

4.The new measure.

``````Total =
VAR _table =
VALUES ( 'Work items with direct links'[ID] ),
"DE", [Defective Effort]
)
RETURN
SUMX ( _table, [DE] )
``````

If you're still confused, please provide some dummy data and expected results.

Best Regards,

Stephen Tao

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

4 REPLIES 4
Frequent Visitor

The problem I was having turned out to be the relationship betwen two tables.  Created a table with only one entry for each sprint # then tied all the tables back to that table with a 1:many instead of many:many.  This resolved the problem.

Community Support

Hi @Thumper369 ,

Here's the solution.

1.The dummy data I created.

2.Create a measure to calculate the Defective Effort.

``````Defective Effort =
CALCULATE (
SUM ( 'Work items with direct links'[Effort] ),
FILTER (
ALLSELECTED ( 'Work items with direct links' ),
[ID] = MAX ( 'Work items with direct links'[ID] )
)
)
``````

3.You can see that the total in the table is incorrect, so we just need to create a new measure to add them correctly.

4.The new measure.

``````Total =
VAR _table =
VALUES ( 'Work items with direct links'[ID] ),
"DE", [Defective Effort]
)
RETURN
SUMX ( _table, [DE] )
``````

If you're still confused, please provide some dummy data and expected results.

Best Regards,

Stephen Tao

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

Super User

@Thumper369 , Try a measure like

or

Frequent Visitor

Sorry, neither of those work.  I tried them on their own, but they did not constarin it to only rows that had  targetworkItem.WorkItemId.
I tried them in my measurement but they still do not exclude the duplicate of 108829

Announcements

#### Power BI Monthly Update - November 2023

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

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors