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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Syndicate_Admin
Administrator
Administrator

Average calculation grouped by project

Hello, I have a problem to perform a calculation in PowerBi, at the moment I had to do it manually in Excel and I need it to be done in a dynamic way.

The problem is the following tengun a base with the record of hours dedicated to the different stages of a project and I need to get the average time of both each stage, as the sum of those average hours of the projects, but that all this can be visible / filtered according to certain parameters. Next I will try to put the structure of the base together with the expected result

Base:

TaskCod ProjectClientGuyModelsHours

Role

Size

Setup001NNCar35.5JrXL
Setup001NNCar31SrXL
Delivery001NNCar32SrXL
Setup002SNCustom11.5SrS
Analysis002SNCustom11SrS
Delivery002SNCustom12.5JrS
Kick off003NCustom20.5JrM

Expected result:

mscabrera_1-1675369129601.png

So basically is the structure I have of the database and what I need to get to is a table / matrix that first adds the hours dedicated to each task PER PROJECT and then shows me the average of each task. I have already done the test and calculating only the average per Task is not the same as adding the hours of each project and there yes get the average per task:

mscabrera_0-1675368989079.png

I appreciate if someone could help me with this since I could not find a solution and as I mentioned before, the idea is that the process works in a more dynamic way when visualizing the information

Michael C.

9 REPLIES 9
Syndicate_Admin
Administrator
Administrator

You can solve this in Power BI by creating a measure that first adds up the hours by Task and Project and then averages over those totals. For example:

PromedioPorTask =
AVERAGEX(
    SUMMARIZE(
        Tabla,
        Tabla[Cod Proyecto],
        Tabla[Task],
        "HorasProyecto", SUM(Tabla[Horas])
    ),
    [HorasProyecto]
)

This measure will ensure that it is first grouped by project and task, add up the hours, and then take the average, also allowing you to apply dynamic filters according to client, type or any other field.

lbendlin
Super User
Super User

your expected outcome doesn't seem to match the sample data. Please provide sanitized sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Hello, thanks for responding.

Below I send sample of the database:

mscabrera_0-1675547232430.png

The expected result would look something like this:

mscabrera_1-1675547626940.png

And these avg Time values come out of in this case the sum of the hours per activity per project and then the average of all the projects selected according to the filters, like this:

mscabrera_3-1675547833909.png

I hope you can help me and I remain attentive in case additional information is required

Sorry, I cannot work with screenshots.  Please provide sample data that covers your issue or question completely.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Hello, I apologize to me, I did not know how to upload a file with the information. Then send link from Wetranfer where I could find a sample of the database along with the expected solution

https://wetransfer.com/downloads/e430e6bd13a17de7f55de50742cfb62320230204231520/bd1286158049dafade5...

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you very much, that was what I needed. Just one more question, there is some way to calculate the sum of those averages obtained like this:

mscabrera_0-1675869712493.png

That large total can be presented on a card

You are welcome.  If my previous reply helped, please mark that as Answer.  Write this measure

Average hours 1 = SUMX(VALUES(Data[TASK]),[Average hours])

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you very much, it worked just as I needed it!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.