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
LS-PScience
Regular Visitor

Average of day for each individual and then average of the last 10 days excluding today

Hi guys

I am trying to average the mRSI from each day for each individual (GB and LS), and then show the average for the last 10 sessions excluding the current session. Expected results for GB are below (less than 10 sessions are shown but I'd like it to average the last 10 sessions (one session = 3 events) if there was enough data.

The average by day is easy enough, its the next part thats tricky...

LSPScience_0-1659432104559.png

In my model I have used the following to calculate average by day for each individual:

AVERAGEX(VALUES('Smarta - Hawkin CMJ'[Date]), [AveragemRSI])

Please see sample data attached

DateNamemRSI Average by day 
Average of last 10 sessions (excluding today)
 
27/07/2022GB0.68 0.69 0.54
"=AVERAGE(E5,E8,E11,E14,E17,E20)"
27/07/2022GB0.71     
27/07/2022GB0.68     
20/07/2022GB0.52 0.48 0.55
"=AVERAGE(E8,E11,E14,E17,E20)"
20/07/2022GB0.28     
20/07/2022GB0.62     
16/06/2022GB0.66 0.59 0.55
"=AVERAGE(E11,E14,E17,E20)"
16/06/2022GB0.71     
16/06/2022GB0.41     
13/04/2022GB0.53 0.54 0.55
"=AVERAGE(E14,E17,E20)"
13/04/2022GB0.55     
13/04/2022GB0.55     
07/04/2022GB0.57 0.52 0.56
"=AVERAGE(E17,E20)"
07/04/2022GB0.42     
07/04/2022GB0.58     
02/02/2022GB0.44 0.53 0.58 
02/02/2022GB0.58     
02/02/2022GB0.58     
27/01/2022GB0.56 0.58   
27/01/2022GB0.57     
27/01/2022GB0.6     
27/07/2022LS0.65     
27/07/2022LS0.43     
27/07/2022LS0.46     
20/07/2022LS0.7     
20/07/2022LS0.6     
20/07/2022LS0.8     
16/06/2022LS0.68     
16/06/2022LS0.55     
16/06/2022LS0.47     
13/04/2022LS0.59     
13/04/2022LS0.6     
13/04/2022LS0.78     
07/04/2022LS0.77     
07/04/2022LS0.65     
07/04/2022LS0.56     
02/02/2022LS0.43     
02/02/2022LS0.34     
02/02/2022LS0.65     
27/01/2022LS0.88     
27/01/2022LS0.76     
27/01/2022LS0.8     


Thanks
1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @LS-PScience ,

 

Please try:

First create a rank column:

Rank = RANKX(FILTER('Smarta - Hawkin CMJ',[Name]=EARLIER('Smarta - Hawkin CMJ'[Name])),[Date],,DESC,Dense)

Output:

vjianbolimsft_0-1659606192797.png

 

Then create a new measure:

Average_ =

CALCULATE (

    AVERAGE ( 'Smarta - Hawkin CMJ'[mRSI] ),

    FILTER (

        ALL ( 'Smarta - Hawkin CMJ' ),

        [Name] = MAX ( 'Smarta - Hawkin CMJ'[Name] )

            && [Rank] > MAX ( 'Smarta - Hawkin CMJ'[Rank] )

            && [Rank]

                <= MAX ( 'Smarta - Hawkin CMJ'[Rank] ) + 10

    )

)

Show items with no data in the table visual:

vjianbolimsft_1-1659606192800.png

 

Output:

vjianbolimsft_2-1659606192801.png

 

Best Regards,

Jianbo Li

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

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @LS-PScience ,

 

Please try:

First create a rank column:

Rank = RANKX(FILTER('Smarta - Hawkin CMJ',[Name]=EARLIER('Smarta - Hawkin CMJ'[Name])),[Date],,DESC,Dense)

Output:

vjianbolimsft_0-1659606192797.png

 

Then create a new measure:

Average_ =

CALCULATE (

    AVERAGE ( 'Smarta - Hawkin CMJ'[mRSI] ),

    FILTER (

        ALL ( 'Smarta - Hawkin CMJ' ),

        [Name] = MAX ( 'Smarta - Hawkin CMJ'[Name] )

            && [Rank] > MAX ( 'Smarta - Hawkin CMJ'[Rank] )

            && [Rank]

                <= MAX ( 'Smarta - Hawkin CMJ'[Rank] ) + 10

    )

)

Show items with no data in the table visual:

vjianbolimsft_1-1659606192800.png

 

Output:

vjianbolimsft_2-1659606192801.png

 

Best Regards,

Jianbo Li

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

amitchandak
Super User
Super User

@LS-PScience , Based on what I got

 

AVERAGEX(VALUES('Smarta - Hawkin CMJ'[Name]),calculate( Average ( 'Smarta - Hawkin CMJ'[RSI]) ) )

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.