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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
MarshalSK
Resolver I
Resolver I

Average per year

Hi Folks, Need quick help to get average. Sharing sample dataset and expected result.

 

MarshalSK_0-1706742781766.png

DateSales
01-Jan-22100
01-Feb-22125
01-Mar-22150
01-Apr-22175
01-May-22200
01-Jun-22225
01-Jul-22250
01-Aug-22275
01-Sep-22300
01-Oct-22325
01-Nov-22350
01-Dec-22375
01-Jan-22200
01-Feb-22225
01-Mar-22250
01-Apr-22275
01-May-22300
01-Jun-22325
01-Jul-22350
01-Aug-22375
01-Sep-22400
01-Oct-22425
01-Nov-22450
01-Dec-22475
01-Jan-2350
01-Feb-2375
01-Mar-23100
01-Apr-23125
01-May-23150
01-Jun-23175
01-Jul-23200
01-Aug-23225
01-Sep-23250
01-Oct-23275
01-Nov-23300
01-Dec-23325
01-Jan-230
01-Feb-2350
01-Mar-23100
01-Apr-23150
01-May-23200
01-Jun-23250
01-Jul-23300
01-Aug-23350
01-Sep-23400
01-Oct-23450
01-Nov-23500
01-Dec-23550

 

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @MarshalSK ,

 

We can create a measure.

avg = 
var _sales=CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),'Table'[Date].[Year]=MAX('Table'[Date].[Year]) ))
var _months=CALCULATE(DISTINCTCOUNT('Table'[Date].[Month]),FILTER(ALLSELECTED('Table'),'Table'[Date].[Year]=MAX('Table'[Date].[Year])))
RETURN DIVIDE(_sales,_months,0)

Then the result is as follows.

vtangjiemsft_0-1706777198304.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

5 REPLIES 5
v-tangjie-msft
Community Support
Community Support

Hi @MarshalSK ,

 

We can create a measure.

avg = 
var _sales=CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),'Table'[Date].[Year]=MAX('Table'[Date].[Year]) ))
var _months=CALCULATE(DISTINCTCOUNT('Table'[Date].[Month]),FILTER(ALLSELECTED('Table'),'Table'[Date].[Year]=MAX('Table'[Date].[Year])))
RETURN DIVIDE(_sales,_months,0)

Then the result is as follows.

vtangjiemsft_0-1706777198304.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

 

 

Perfect 

aj1973
Community Champion
Community Champion

Hi @MarshalSK 

Check this out

https://drive.google.com/file/d/1B6a4W2QAzufL8ixPs5i0axhvCCHuD7C3/view?usp=sharing

aj1973_0-1706745404254.png

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Daniel29195
Super User
Super User

@MarshalSK 

calculate (

sum(tblname[sales_col_name]),

removefilters( tbl_name[month_col_name], tbl_name[month_nb_col_name])

)

/ 12 

 

 

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution !
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠@

 

Thanks for the reply. Expecting dynamic solution, meaning 12 needs to be dynamic. 

considering below scenario
1. month slicer

2. if any month doesn't have data

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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