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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Peavey
Helper III
Helper III

Calculate based on other columns

Hello,

 

I have this similar dataset: 

IdTask     Progress     Id Main task
1Main task 1     ? 
2Sub task 1     55     1
3Sub task 2     20     1
4Main task 2     ? 
5Sub task 1     10     4
6Sub task 2     0     4
7Sub task 3     95     4
8Main task 3     ? 
9Sub task 1     50     8

 

Intention is to find the average progress based on the sub tasks in each main task. 

My start is: IF(Id main task = BLANK(), ???    Then I need to select all rows with id main task = Id and average these. 

 

How to?

 

Thanks

1 ACCEPTED SOLUTION
vojtechsima
Super User
Super User

Hello, @Peavey 
Try something like this:

vojtechsima_0-1736204057252.png

Average progress = 
var currentId = SELECTEDVALUE('Table'[Id])
var averageSubtasks = AVERAGEX(FILTER(ALL('Table'), 'Table'[     Id Main task] = currentId), 'Table'[     Progress])

return averageSubtasks

View solution in original post

5 REPLIES 5
Peavey
Helper III
Helper III

Thanks for all the help, I found @vojtechsima solution to fit my needs very well!

This community is so impressive, so much knowledge and helpful people here, many thanks again!

 

-A-

@Peavey  Happy to help, kudos appreciated. Thank you too

v-kongfanf-msft
Community Support
Community Support

Hi @Peavey ,

 

You can try formula like below to create calculate column and measure:

SubTaskProgress = IF(NOT(ISBLANK([Id Main task])), [Progress], BLANK())

vkongfanfmsft_0-1736214849048.png

AverageProgress = 
CALCULATE(
    AVERAGE([SubTaskProgress]),
    ALLEXCEPT(TableName, TableName[Id Main task])
)

vkongfanfmsft_1-1736214880646.png

 

Best Regards,
Adamk Kong

 

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

what's 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!




vojtechsima
Super User
Super User

Hello, @Peavey 
Try something like this:

vojtechsima_0-1736204057252.png

Average progress = 
var currentId = SELECTEDVALUE('Table'[Id])
var averageSubtasks = AVERAGEX(FILTER(ALL('Table'), 'Table'[     Id Main task] = currentId), 'Table'[     Progress])

return averageSubtasks

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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