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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Calculate average for sales per month so that every day returns the same monthly value

Hi, I need help calculating the average for sales per month so that every day returns the same monthly value.

In Excel it looks like this:

 

Hris_0-1624006712830.png

 

The measure I am using in PBI does not calculate per month, it calculates per row:

 
Hris_2-1624007223872.png

 How can I create a measure in PBI for the following sample data that calculates the average per month (showing the same values for a month) if the Date field is used in the table?

DateMonthYearSales
01/01/21202118263
01/02/212021111930
01/04/212021113123
02/02/212021219201
02/07/212021223661
02/08/212021218552
02/09/212021224552
03/01/212021319002
03/13/212021315662
03/14/212021323897
03/15/212021322375
Thanks!
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a measure like this with a date table

 

this Daily Avgmonth = CALCULATE(AverageX(values(Date[Date]), calculate(sum(Sales[Sales]))),DATESMTD(ENDOFMONTH('Date'[Date])))

 

 

use date from date table in visual

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
Clinical_Epi
Advocate III
Advocate III

That worked for me too - another way that gave me the same answer is:

   TOTALMTD(AVERAGEX('Date',[sales_sum]),'Date'[Date])
AlB
Community Champion
Community Champion

Hi @Anonymous 

Try this measure. See it all at work in the attached file.

Measure = 
CALCULATE(AVERAGE(Table1[Sales]), ALLEXCEPT(Table1,Table1[MonthYear]))

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Jihwan_Kim
Super User
Super User

 

Picture1.png

 

Sales Total : =
SUM(Sales[Sales])
 
Avg per Month : =
IF (
HASONEVALUE ( Dates[M & Y] ),
IF (
NOT ISBLANK ( [Sales Total :] ),
AVERAGEX (
FILTER ( ALL ( Dates ), Dates[M & Y] = MAX ( Dates[M & Y] ) ),
[Sales Total :]
)
),
AVERAGEX ( Dates, [Sales Total :] )
)
 
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
amitchandak
Super User
Super User

@Anonymous , Try a measure like this with a date table

 

this Daily Avgmonth = CALCULATE(AverageX(values(Date[Date]), calculate(sum(Sales[Sales]))),DATESMTD(ENDOFMONTH('Date'[Date])))

 

 

use date from date table in visual

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks, everyone, this helped!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors