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
x-File
Helper I
Helper I

Average recruitment rate

Hi all,

 

I work for a company that recruits people for different studies to participate in. What I am trying to see and visualize is how I can get an average recruitment rate number per study, preferably over different timelines.

 

For example (all data is in example table by the way), Study 1937-A recruited 2 people in Feb 19, 3 on Feb 24, and the last on August 18.

I would like to see the recruitment rate if that's possible, so just a simple card telling: average inclusion rate for study X is X people per week/month/quarter.

 

Is there a measure fot that? I tried but it didn't work.

Thanks in advance!

StudyPhase# of peopleDateDay number
Study 1800 Cohort 1A220/10/20-1
Study 1800 Cohort 1B121/10/20-1
Study 1800 Cohort 1C125/10/20-1
Study 1800 Cohort 1D126/10/20-1
Study 1800 Cohort 1E202/11/20-1
Study 1800 Cohort 1F218/11/20-1
Study 1937 Cohort 1a 219/02/20-2
Study 1937 Cohort 1b324/02/20-2
Study 1937 Cohort 1c326/02/20-2
Study 1937 Cohort 2a309/03/20-2
Study 1937 Cohort 2b411/03/20-2
Study 1937 Cohort 3a + FE414/06/20-2
Study 1937 Cohort 3b + FE416/06/20-2
Study 1937 Cohort 4a428/06/20-2
Study 1937 Cohort 4b430/06/20-2
Study 1937 Cohort 5a426/07/20-2
Study 1937 Cohort 5b428/07/20-2
Study 1937 Cohort 6a209/08/20-2
Study 1937 Cohort 6b316/08/20-2
Study 1937 Cohort 6c318/08/20-2
1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @x-File ,

You can modify the function to the following form:

Flag2 =
VAR _select =
    SELECTEDVALUE ( 'Table'[Study] )
VAR _week =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[week] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Study] = MAX ( 'Table'[Study] ) )
    )
VAR _sum =
    SUMX (
        FILTER ( ALL ( 'Table' ), 'Table'[Study] = MAX ( 'Table'[Study] ) ),
        [# of people]
    )
VAR _averageweek =
    DIVIDE ( _sum, _week )
VAR _month =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[month] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Study] = MAX ( 'Table'[Study] ) )
    )
VAR _averagemonth =
    DIVIDE ( _sum, _month )
VAR _quarter =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[quarter] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Study] = MAX ( 'Table'[Study] ) )
    )
VAR _averagequarter =
    DIVIDE ( _sum, _quarter )
RETURN
    "average inclusion rate for study" & " " & _select & " " & "is" & " "
        & ROUNDUP ( _averageweek, 0 ) & " " & "people per week" & " / "
        & ROUNDUP ( _averagemonth, 0 ) & " " & "people per month" & " / "
        & ROUNDUP ( _averagequarter, 0 ) & " " & "people per quarter"

Result:

vyangliumsft_0-1667176956507.png

 

Best Regards,

Liu Yang

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

View solution in original post

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @x-File ,

You can modify the function to the following form:

Flag2 =
VAR _select =
    SELECTEDVALUE ( 'Table'[Study] )
VAR _week =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[week] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Study] = MAX ( 'Table'[Study] ) )
    )
VAR _sum =
    SUMX (
        FILTER ( ALL ( 'Table' ), 'Table'[Study] = MAX ( 'Table'[Study] ) ),
        [# of people]
    )
VAR _averageweek =
    DIVIDE ( _sum, _week )
VAR _month =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[month] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Study] = MAX ( 'Table'[Study] ) )
    )
VAR _averagemonth =
    DIVIDE ( _sum, _month )
VAR _quarter =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[quarter] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Study] = MAX ( 'Table'[Study] ) )
    )
VAR _averagequarter =
    DIVIDE ( _sum, _quarter )
RETURN
    "average inclusion rate for study" & " " & _select & " " & "is" & " "
        & ROUNDUP ( _averageweek, 0 ) & " " & "people per week" & " / "
        & ROUNDUP ( _averagemonth, 0 ) & " " & "people per month" & " / "
        & ROUNDUP ( _averagequarter, 0 ) & " " & "people per quarter"

Result:

vyangliumsft_0-1667176956507.png

 

Best Regards,

Liu Yang

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

v-yangliu-msft
Community Support
Community Support

Hi  @x-File ,

 

Here are the steps you can follow:

1. Create calculated column.

week =
WEEKNUM('Table'[Date],1)
month = MONTH('Table'[Date])
quarter = QUARTER('Table'[Date])

2. Create measure.

Flag =
VAR _select =
    SELECTEDVALUE ( 'Table'[Study] )
VAR _week =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[week] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Study] = MAX ( 'Table'[Study] ) )
    )
VAR _sum =
    SUMX (
        FILTER ( ALL ( 'Table' ), 'Table'[Study] = MAX ( 'Table'[Study] ) ),
        [# of people]
    )
VAR _averageweek =
    DIVIDE ( _week, _sum )
VAR _month =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[month] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Study] = MAX ( 'Table'[Study] ) )
    )
VAR _averagemonth =
    DIVIDE ( _month, _sum )
VAR _quarter =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[quarter] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Study] = MAX ( 'Table'[Study] ) )
    )
VAR _averagequarter =
    DIVIDE ( _quarter, _sum )
RETURN
    "average inclusion rate for study" & " " & _select & " " & "is" & " "
        & FORMAT ( _averageweek, "Percent" ) & " " & "people per week" & " / "
        & FORMAT ( _averagemonth, "Percent" ) & " " & "people per month" & " / "
        & FORMAT ( _averagequarter, "Percent" ) & " " & "people per quarter"

3. Result:

vyangliumsft_0-1666663502041.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

Thank you very much! Just a quick question on this: why did you this in percentages? As in: is it possible to change this to (for example): per month 3 people are recruited on average instead of 22% is recruited?

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.