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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
admin_xlsior
Post Prodigy
Post Prodigy

Monthly average including no transactions

Dear friends,

 

When I have a transactions that in some case the month is skip means no activity in certain month, and I'm averaging my transaction using this DAX =

 

 

avg.monthly sales = AVERAGEX(
                    VALUES(Dates[Month]),
                    [net sales]
                    )

 

 

 

how to get the average factor to be the whole numbers of months ?

The Dates dimension is the usual date table which of course have all complete months, but because my transaction is for example have skip month like :

MonthNet sales
May 202150
Jun 2021100
August 2021200

 

For monthly average shouldn't be it is 250 / 4 instead 250 /3 ?

Also because the months is deliberately chosen from slicer, so I did choose June 2021, provided it has value or not, I think I want all selected month to be included in the average. 

 

Thanks

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Assuming your Dates table doesn't have missing months, you can likely solve this just by adding "+ 0".

avg.monthly sales = AVERAGEX ( VALUES ( Dates[Month] ), [net sales] + 0 )

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

Assuming your Dates table doesn't have missing months, you can likely solve this just by adding "+ 0".

avg.monthly sales = AVERAGEX ( VALUES ( Dates[Month] ), [net sales] + 0 )

Hmm, haven't thought about that. I actually just change my formula to just use DIVIDE with COUNTROWS(AllSelected(Date[month]))

 

I will try your approach, it looks like a great idea.

 

Thanks!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.