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
CameronTCD
Helper I
Helper I

Getting results from past dates

I've got a report that displays scores for different programme areas and a slicer atop that filters the scores by period (4-week time periods.)

 

I'm using KPIs and want the goal to display the calculation of the average of the previous 3 periods' score.

I have photos below going into more depth. 

 

 

So, as an example, when sliced by period 4, it will calculate the avergae of p1, p2 and p3. 

 

Help would be much appreciated!

 

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @CameronTCD ,

 

You can create columns to get year and Period, then create measure to get average.

 

Year= MID(Table1[Period],7,4)

 

Period=INT(MID(Table1[Period],2,2))

 

Measure1= CALCULATE(AVERAGE(Table1[Score_Value]),FILTER(ALLSELECTED(Table1), Table1[Year]=MAX(Table1[Year])&&Table1[Period]<MAX(Table1[Period])))

 

Best Regards,

Amy

 

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

4 REPLIES 4
v-xicai
Community Support
Community Support

Hi  @CameronTCD ,

 

Does that make sense? If so, kindly mark my answer as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

 

Best regards

Amy

v-xicai
Community Support
Community Support

Hi @CameronTCD ,

 

You can create columns to get year and Period, then create measure to get average.

 

Year= MID(Table1[Period],7,4)

 

Period=INT(MID(Table1[Period],2,2))

 

Measure1= CALCULATE(AVERAGE(Table1[Score_Value]),FILTER(ALLSELECTED(Table1), Table1[Year]=MAX(Table1[Year])&&Table1[Period]<MAX(Table1[Period])))

 

Best Regards,

Amy

 

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

 

Hi @v-xicai 

 

Thanks for your reply.

Before I test however, would this work?

 

The periods are 4 weeks long, not accounting for the 2/3 days at the end of the months.

This means that some periods span across two months.

 

Regards,

Cameron

Hi @CameronTCD ,

 

You can have a try, maybe you need to rename the Month to Period in the formula above.

 

If I misunderstood it, could you please share your sample data for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.

 

Best Regards,

Amy

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.