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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
Anonymous
Not applicable

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

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

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?

Anonymous
Not applicable

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

Worked like a charm.

 

Thank you very much.

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.