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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
alevandenes
Helper IV
Helper IV

average sales per month per year

Hi all,

 

i am trying to obtain with a measure the average sales per month per a specific year. 

In particular:

- if the year is finished, i want to SUM all the sales per a specific year and then divide it by 12 

- if the year is still ongoing, i want to SUM all the sales for the months passed then divide that number by the number of months passed. for example, if the measure is calculate today i want to sum sales of 2021 divided 6 (months inc June).

 

the formula i used below is: 

Avg sales per month 2019 = CALCULATE(([sales]/12), YEAR(DATE'[Date])=2019)
It is working for 2019 but not for 2020 and 2021 - any suggestions on how to make this a rolling formula with the change of the year? 
 

alevandenes_0-1626874009574.png

 

1 ACCEPTED SOLUTION
alevandenes
Helper IV
Helper IV

I actually solved this myself creating the "virtual" table below

 

Table 3 = SUMMARIZE(SALES, 'Legend - DATE'[Year], "sales", [sales], "average", if('Legend - DATE'[Year]<YEAR(today()), [sales]/12, ([sales]/(MONTH(TODAY())-1))))

View solution in original post

4 REPLIES 4
alevandenes
Helper IV
Helper IV

I actually solved this myself creating the "virtual" table below

 

Table 3 = SUMMARIZE(SALES, 'Legend - DATE'[Year], "sales", [sales], "average", if('Legend - DATE'[Year]<YEAR(today()), [sales]/12, ([sales]/(MONTH(TODAY())-1))))
ryan_mayu
Super User
Super User

@alevandenes 

maybe you can try this

Measure = CALCULATE(Sales[Sales-total],ALLEXCEPT('Table','Table'[year]))/12

1.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

@alevandenes , Try like 

 

This year Sales = CALCULATE(([Sales Amount])/12,DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))

 

or

 

This year Sales = CALCULATE(averagex(values('Date'[Month year]), [Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

they do not work 😞

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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