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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Dcichy
New Member

How to create average formule based on different data

Hi guys 
I've got tricky question about creating new Average formule. I would like to create formula which will show average of days from specyfic tasks. Tasks should be calculated as for example: task 1 is typed twice so sum of this task equals 12, task 2 lasts 3 days, task  4 lasts 7 days. 

Task              days

1                      4
1                      8
2                      3
3                      7

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Dcichy ,

May I ask if your problem has been solved. If the above reply was helpful, you may consider marking it as solution. If the problem is not yet solved, you can follow the steps below:

Add new measure:

result =
VAR _total =
    CALCULATE (
        SUM ( 'Table'[days] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Task] = SELECTEDVALUE ( 'Table'[Task] ) )
    )
VAR _count =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( ALL ( 'Table' ), 'Table'[Task] = SELECTEDVALUE ( 'Table'[Task] ) )
    )
RETURN
    _total / _count

Final output:

vyifanwmsft_0-1719904680336.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

6 REPLIES 6
Anonymous
Not applicable

Hi @Dcichy ,

May I ask if your problem has been solved. If the above reply was helpful, you may consider marking it as solution. If the problem is not yet solved, you can follow the steps below:

Add new measure:

result =
VAR _total =
    CALCULATE (
        SUM ( 'Table'[days] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Task] = SELECTEDVALUE ( 'Table'[Task] ) )
    )
VAR _count =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER ( ALL ( 'Table' ), 'Table'[Task] = SELECTEDVALUE ( 'Table'[Task] ) )
    )
RETURN
    _total / _count

Final output:

vyifanwmsft_0-1719904680336.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

ryan_mayu
Super User
Super User

@Dcichy 

not clear about this. You want the average. Thne you said for task 1 the sum is 12. Then what's the expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @ryan_mayu 
I meant that sum of days for task 1 is 4+8, because this tasks appears twice, and this formula should count it as 12 because this is one task with duration splited into two

@Dcichy 

you can use sum(days) 

11.PNG

 

not sure if this is the output that you want





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I mentioned very simple example. I tried to support myself with ChatGPT but i doesn't work. ChatGPR suggested to creat first column like this:

Averageoftasks=
SUMMARIZE(Tasks, Tasks[TaskName], "Sumdays", SUM(Tasks[task duration ])
)

and then measure:

SredniaDniZadan =
AVERAGEX(
Averageoftasks,
[Sumdays]
)

I received problem like: The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

why not create a measuer and use average?

Measure = average('Table'[days])
 
11.PNG
 
if this is not what you want, then pls provide the expected output based on the sample data you provided.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.