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
ANHAMINE
Regular Visitor

AVERAGEX formula not taking the accurate figures

I want to take Monthly Average of few numbers from a certain date range

 

Both the figures [ Date ] & [ Qty] are available in single table.

 

I am trying to use following formula : 

 

Average Demand = AVERAGEX(VALUES[Table1[Date].[Month]),CALCULATE(SUM(Table1[QTY],DATESBETWEEN[Table1[Date], Start Date , End Date))

 

Output I am getting is simply 'Summation' of Qty , not the 'Monthly Average' as desired.

 

If I remove .[Month] , it gives me certain average but it is based on 'Daily Average' - not 'Monthly' - 

 

Can someone please help in here?

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @ANHAMINE 

you need a dedicated month column to average on, like

Month = FORMAT([Date], "YYYYMM")

 

 

then rewrite the measure like:

Average Demand = AVERAGEX(VALUES[Table1[Month]),CALCULATE(SUM(Table1[QTY],DATESBETWEEN[Table1[Date], Start Date , End Date))

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @ANHAMINE 

you need a dedicated month column to average on, like

Month = FORMAT([Date], "YYYYMM")

 

 

then rewrite the measure like:

Average Demand = AVERAGEX(VALUES[Table1[Month]),CALCULATE(SUM(Table1[QTY],DATESBETWEEN[Table1[Date], Start Date , End Date))

It worked ! You are simply magical 😊

 

Thank you for all your help !

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.