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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mark_carlisle
Advocate IV
Advocate IV

SUMX on a measure not working as intended

I want to be able to calculate the percentage of agents within a team hitting target.

 

Only agents that have a target should be include in the calculation. This is how I would like the data to display in a table format;

 

Level 5.FullNameLevel 6.FullNameClosed Won ReferralsTarget To DateEmployee CountHas TargetTotal Employees With A TargetIs Hitting MTD Target (0/1)Total Employees Hitting Target (0/1)Achieving MTD Target (%)
Manager LRAgent GD4211111100.00%
Manager LRAgent GS111011111100.00%
Manager LRAgent X2 1     
Totals 171231212100.00%

 

In the above example Agent X would not be included in the calculation for Achieving MTD Target (%) as they do not have a target. The columns highlighted in Orange are all measures.

 

My issue is that the measure Total Employees Hitting Target (0/1) is not working as expect. The result of the measures is shown below.

 

Level 5.FullNameLevel 6.FullNameClosed Won ReferralsTarget To DateEmployee CountHas TargetTotal Employees With A TargetIs Hitting MTD Target (0/1)Total Employees Hitting Target (0/1)Achieving MTD Target (%)
Manager LRAgent GD4211111100.00%
Manager LRAgent GS1110111100.00%
Totals 15112121150.00%

 

As can be seen in the columns in Red, Agent GS has 11 Closed Won Referrals to Date and a target of 10 therefore Total Employees Hitting Target (0/1) should be 1 not 0. The DAX for this measure is;

 

 

 

Total Employees Hitting Target (0/1) = 
SUMX( Lineup, [Is Hitting MTD Target (0/1)] )

 

 

 

And as can be seen Is Hitting MTD Target (0/1) is calculating correctly.

 

I have a sample dataset on OneDrive (link below) that reflects what is happening in the real dataset to assist with troubleshooting. I'm at a loss as to why this is not working when I have used SUMX to sum the measures in the past, so any assistance is greatly appreciated.

 

https://1drv.ms/u/s!AkFN9EElJAPfjzFsmSO9zKHXrgAP?e=dLC0t2

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Here's your measure:

    SUMX(
        values( Lineup[Level 6.FullName] ),
        [Is Hitting MTD Target (0/1)]
    )

Best

D

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Here's your measure:

    SUMX(
        values( Lineup[Level 6.FullName] ),
        [Is Hitting MTD Target (0/1)]
    )

Best

D

This one worked.

 

Thank you for the assistance.

Greg_Deckler
Super User
Super User

Perhaps:

 

Total Employees Hitting Target (0/1) = 
SUMX( FILTER(Lineup,NOT(ISBLANK([Has Target]))), [Is Hitting MTD Target (0/1)] )

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors