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
Anonymous
Not applicable

Average by month for a dimension measure

Best way to explain this is with an example.

 

For sales, the grain is the line item transaction.  These are associated with an order dimension and these orders have a fulfillment metric for the days between order placed and order fulfilled.

 

The transaction table has the order date tied to the master calendar.  When I created a measure AVERAGE(ORDERS[Days to Fulfillment])) I can get the overall average but when I add in the order date month, it shows this same overall average for each month.  I need the average fulfillment days for each month based on order date.

Capture.PNG

 

 

 

 

 

 

 

Hope I'm explaining this correctly.

4 REPLIES 4
Icey
Community Support
Community Support

Hi @Anonymous ,

Is this what you want?

sum.PNG

If so, create your measure like so:

Average of fulfillment days 2 =
AVERAGEX (
    'FACT',
    DATEDIFF ( 'FACT'[Order date], 'FACT'[Complete date], DAY ) + 1
)

PBIX file attached.

 

Best Regards,
Icey

 

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

Anonymous
Not applicable

No - jan has two orders of 15 & 7 days so the average is 15+7/2 = 11.  Where are you getting 11.57 ?

Icey
Community Support
Community Support

Hi @Anonymous ,

Try this:

DateDiff of day +1 = DATEDIFF ( MAX ( 'FACT'[Order date] ), MAX ( 'FACT'[Complete date] ), DAY ) + 1
Average = AVERAGEX ( VALUES ( 'FACT'[Order] ), [DateDiff of day +1] )

 average.PNG

 

Best Regards,
Icey

 

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

DS12345
Frequent Visitor

Hi @Anonymous ,

 

I think the solution to your problem is explained in this article:

 

https://community.powerbi.com/t5/Desktop/Calculate-an-average-from-a-Sum-by-Month/td-p/27250

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.