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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
MacyMolly
Helper II
Helper II

`HELP!

Hi @Icey  or anyone, I badly need your help on this.

 

I'm trying to create a measure that will calculate tenure in days it took them to achieved the goal (the ones highlighted in green). But, the student need to get the passing rate (>= 90%) for at least two consecutive weeks.. Like for example, looking at the below tables, I only need to view (TTP column) the tenure in days of the second week(the first two weeks that they achieved the passing rate). Any help is greatly appreciated.

 

Passing Rates s/b >= 90%


Sample data: Sample data   

 

 

MacyMolly_0-1634837436829.png

 

Measures:

MacyMolly_1-1634838405203.png

 

Transform data:

MacyMolly_2-1634838621257.png

 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Without your pbix file, I made a simple table to demonstrate a DAX expression that shows one way to do this.

 

AgentTenureResult

Joe 1 8
Joe 8 9
Joe 15 9
Joe 22 8
Joe 29 9
Mary 1 9
Mary 8 9
Mary 15 7
Mary 22 9
Mary 29 7
Sally 1 9
Sally 8 8
Sally 15 9
Sally 22 9
Sally 29 9

 

mahoneypat_0-1634858698389.png

 

 

FirstTenureTwoWeeksOver9 =
VAR summary =
    ADDCOLUMNS (
        SUMMARIZE ( Results, Results[Agent], Results[Tenure] ),
        "cResults"CALCULATE ( SUM ( Results[Result] ) )
    )
VAR withprevvalue =
    ADDCOLUMNS (
        summary,
        "cPrevResult",
            VAR thisagent = Results[Agent]
            VAR thistenure = Results[Tenure]
            RETURN
                MINX (
                    FILTER (
                        summary,
                        Results[Agent] = thisagent
                            && Results[Tenure] = thistenure - 7
                    ),
                    [cResults]
                )
    )
VAR result =
    MINX (
        FILTER ( withprevvalue, [cResults] >= 9 && [cPrevResult] >= 9 ),
        Results[Tenure]
    )
RETURN
    result

 

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Microsoft Employee
Microsoft Employee

Not sure what you mean.  Just the simple average is AVERAGE(Results[Tenure])

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


mahoneypat
Microsoft Employee
Microsoft Employee

Without your pbix file, I made a simple table to demonstrate a DAX expression that shows one way to do this.

 

AgentTenureResult

Joe 1 8
Joe 8 9
Joe 15 9
Joe 22 8
Joe 29 9
Mary 1 9
Mary 8 9
Mary 15 7
Mary 22 9
Mary 29 7
Sally 1 9
Sally 8 8
Sally 15 9
Sally 22 9
Sally 29 9

 

mahoneypat_0-1634858698389.png

 

 

FirstTenureTwoWeeksOver9 =
VAR summary =
    ADDCOLUMNS (
        SUMMARIZE ( Results, Results[Agent], Results[Tenure] ),
        "cResults"CALCULATE ( SUM ( Results[Result] ) )
    )
VAR withprevvalue =
    ADDCOLUMNS (
        summary,
        "cPrevResult",
            VAR thisagent = Results[Agent]
            VAR thistenure = Results[Tenure]
            RETURN
                MINX (
                    FILTER (
                        summary,
                        Results[Agent] = thisagent
                            && Results[Tenure] = thistenure - 7
                    ),
                    [cResults]
                )
    )
VAR result =
    MINX (
        FILTER ( withprevvalue, [cResults] >= 9 && [cPrevResult] >= 9 ),
        Results[Tenure]
    )
RETURN
    result

 

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi @mahoneypat ,
Quick question, how can you get the average of the column tenure?

MacyMolly_0-1635441494841.png

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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