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
phelms
Frequent Visitor

Count results with dynamic filtering

I am trying to count how many agent that is on target at least 75% of the time in percentage of total number of agents on work in the same period, and show that on a single card. 

 

In a table, that is pretty straight forward to calculate per agent, using this measure: SUM([on target]) / SUM([at work]), but I can not seem to figure out how to get the total percentage of agents that were on target at least 75% of the time, to show.

 

Also, I want the calculation to be dynamic, so that I can change the week range in a slicer to adjust the result accordingly.

 

What am I missing?

 

Data table:

fullnameweekon targetoff targetat work
Agent112101
Agent27101
Agent211011
Agent210011
Agent29011
Agent28011
Agent25011
Agent23011
Agent21011
Agent24011
Agent22011
Agent33101
Agent32101
Agent35101
Agent34101
Agent43101
Agent42101
Agent41101
Agent45101
Agent47101
Agent44101
Agent413011
Agent412011
Agent411011
Agent410011
Agent49011
Agent46011
Agent514101
Agent517101
Agent518101
Agent515101
Agent516101
Agent513011
Agent519011
Agent63101
Agent62101
Agent61101
Agent65101
Agent612101
Agent611101
Agent614101
Agent68101
Agent615101
Agent616101
Agent64101
Agent66101
Agent63101
Agent62101
Agent65101
Agent66101
Agent69011
Agent68011
Agent61011
Agent75101
Agent713011
Agent718011
Agent714011
Agent717011
Agent719011
Agent712011
Agent711011
Agent716011
Agent715011
Agent77011
Agent710011
Agent79011
Agent78011
Agent73011
Agent71011
Agent76011
Agent74011
Agent72011
1 ACCEPTED SOLUTION

HI @phelms,

 

You can use below formula to get the total percent with conditions:

100% / 75% Taget Percent =
VAR temp =
    SUMMARIZE (
        'Sample',
        [fullname],
        "Pecent", CALCULATE (
            SUM ( 'Sample'[on target] ) / SUM ( 'Sample'[at work] ),
            ALLSELECTED ( 'Sample' ),
            VALUES ( 'Sample'[fullname] ),
            VALUES ( 'Sample'[week] )
        )
    )
RETURN
    FORMAT (
        COUNTROWS ( FILTER ( temp, [Pecent] = 1 ) )
            / COUNTROWS ( VALUES ( 'Sample'[fullname] ) ),
        "Percent"
    )
        & " / "
        & FORMAT (
            COUNTROWS ( FILTER ( temp, [Pecent] > 0.75 ) )
                / COUNTROWS ( VALUES ( 'Sample'[fullname] ) ),
            "Percent"
        )

2.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

HI @phelms,

 

You can try to use below measure to calculate on target percent.

 

Formula:

On target Percent =
CALCULATE (
    SUM ( 'Sample'[on target] ) / SUM ( 'Sample'[at work] ),
    ALLSELECTED ( 'Sample' ),
    VALUES ( 'Sample'[fullname] ),
    VALUES ( 'Sample'[week] )
)

 

Result:

15.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Almost there. 

 

What I want to do, is to count how many agents were on target 100% as a percent of whole (in this example 2/7 = 28.6%), and how many agents were on target at least 75% of the time (3/7 = 42.9%).

 

Can I do that?

HI @phelms,

 

You can use below formula to get the total percent with conditions:

100% / 75% Taget Percent =
VAR temp =
    SUMMARIZE (
        'Sample',
        [fullname],
        "Pecent", CALCULATE (
            SUM ( 'Sample'[on target] ) / SUM ( 'Sample'[at work] ),
            ALLSELECTED ( 'Sample' ),
            VALUES ( 'Sample'[fullname] ),
            VALUES ( 'Sample'[week] )
        )
    )
RETURN
    FORMAT (
        COUNTROWS ( FILTER ( temp, [Pecent] = 1 ) )
            / COUNTROWS ( VALUES ( 'Sample'[fullname] ) ),
        "Percent"
    )
        & " / "
        & FORMAT (
            COUNTROWS ( FILTER ( temp, [Pecent] > 0.75 ) )
                / COUNTROWS ( VALUES ( 'Sample'[fullname] ) ),
            "Percent"
        )

2.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Worked like a charm.

 

Thank you very much.

 

 

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.