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
emkane
Helper I
Helper I

Monthly and constant average over time per category

Hi All,

 

Desperately trying to figure out a solution here. My data table 'WorkOrders' looks like this:

 

Data.jpg

I need to show the monthly average count from all the locations for all work orders with a line showing the average of all months. Something like this:

Output.jpg

 

I also need to show per location, per priority, and per catagory over time. 

 

Thanks in advance! 

1 ACCEPTED SOLUTION

Hi @emkane ,

 

We can use the following measures to meet your requirement:

 

Monthly Average of Location = AVERAGEX(GROUPBY(WOs,WOs[Location],WOs[Year],'WOs'[Month]),CALCULATE(SUM(WOs[count])))

 

Average Per Month of All = SUMX(GROUPBY(WOs,WOs[Year],WOs[Month]),AVERAGEX(GROUPBY(WOs,WOs[Year],WOs[Month],WOs[Location]),CALCULATE(SUM(WOs[count]))))

 

All Time Average = AVERAGEX(GROUPBY(WOs,WOs[Year],'WOs'[Month]),CALCULATE(SUM(WOs[count])))

 

3.jpg


By the way, PBIX file as attached.


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Greg_Deckler
Super User
Super User

Not 100% on this but maybe things like:

 

AvgAllMonth = 
  AVERAGEX(ALL('Table'),[count])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks, but I need to sum up the count per day (and/or month) before averaging. 

Annotation 2020-04-16 133758.jpg

Hi @emkane ,

 

We can create  following measures to meet your requirment:

 

Avg Per Day =
AVERAGEX (
    GROUPBY ( 'Table', 'Table'[Complete Date] ),
    CALCULATE ( SUM ( 'Table'[count] ) )
)

 

Avg Per Location =
AVERAGEX (
    GROUPBY ( 'Table', 'Table'[Complete Date], 'Table'[Location] ),
    CALCULATE ( SUM ( 'Table'[count] ) )
)

 


If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to OneDrive For Business and share the link here.


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks @v-lid-msft ! That works and gets me this:

 Annotation 2020-04-20 095523.jpg

I also need the average of Avg Per Day (722.81) I have tried to filter ALLEXCEPT, but I am still doing something wrong. 

 

Hi @emkane ,

 

We try to use the following measure to fix it:

 

Avg Per Day =
AVERAGEX (
    GROUPBY (
        'Table',
        'Table'[Complete Date].[Year],
        'Table'[Complete Date].[Month]
    ),
    CALCULATE ( SUM ( 'Table'[count] ) )
)


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you , 

 

That didn't work, and upon closer inspection, the other solutions are not giving me what I am looking for either.

I have outlined below the averages I am trying to calculate; Average Per Month of All, Monthly Average of All, Monthly Average of Location, and All Time Average.

 

Annotation 2020-04-21 131525.png

My data set is here:

Thanks again for all the help, I am very appreciative! 

Hi @emkane ,

 

We can use the following measures to meet your requirement:

 

Monthly Average of Location = AVERAGEX(GROUPBY(WOs,WOs[Location],WOs[Year],'WOs'[Month]),CALCULATE(SUM(WOs[count])))

 

Average Per Month of All = SUMX(GROUPBY(WOs,WOs[Year],WOs[Month]),AVERAGEX(GROUPBY(WOs,WOs[Year],WOs[Month],WOs[Location]),CALCULATE(SUM(WOs[count]))))

 

All Time Average = AVERAGEX(GROUPBY(WOs,WOs[Year],'WOs'[Month]),CALCULATE(SUM(WOs[count])))

 

3.jpg


By the way, PBIX file as attached.


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you!

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.