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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Help with Power Query - Table Column

My second question for the day.. Hope someone can dispense some advice. Not looking for someone to do my work for me here (feel free tho) but any blogs, guides or starting tips about this topic would be great.

 

In my model I have a few tables, and two of them are related to each other in a one-to-many relationship baed on a text column (which is a formatted date) via Merge Query.

 

The column in question is called Accelo Available Hours. Here's a screen shot:

 

image.png

So, what I want to do in the top table, is add a few columns using data from the bottom one. I want to calculate the number of FTEs available on a given day by summing the available_hours column from the bottom table and dividing by the count of the rows, then dividing by 8. I want to do that with the whole table, then filtered by the 3 groups, either by group_id or Group.GroupName, resulting 4 new columns in the top table.

 

Can someone point me somewhere to get started with this kind of query, or give me a hint to get going?

 

Thanks.

1 ACCEPTED SOLUTION
ImkeF
Community Champion
Community Champion

Hi

if you add a column to your top table with the following formula: Table.RowCount( [Accelo Available Hours]), then you'd get your first number. 

 

To add numbers from a column, you first have to convert it into a list: [Accelo Available Hours][available_hours]

Then wrap that list into the function that sums it up like so: List.Sum( [Accelo Available Hours][available_hours] )

 

To do this on a group-level, I'd recommend to create a new query where you pick out one of those tables, apply the transformations and turn this into a function (with the table as an input parameter). Then apply that function in the top table.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

2 REPLIES 2
ImkeF
Community Champion
Community Champion

Hi

if you add a column to your top table with the following formula: Table.RowCount( [Accelo Available Hours]), then you'd get your first number. 

 

To add numbers from a column, you first have to convert it into a list: [Accelo Available Hours][available_hours]

Then wrap that list into the function that sums it up like so: List.Sum( [Accelo Available Hours][available_hours] )

 

To do this on a group-level, I'd recommend to create a new query where you pick out one of those tables, apply the transformations and turn this into a function (with the table as an input parameter). Then apply that function in the top table.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

@ImkeF  Excellent, works beautifully, thanks.

 

This is the formula I used for my new column to get the total available FTEs:

 

((List.Sum ([Accelo Available Hours][available_hours]) / Table.RowCount( [Accelo Available Hours]) ) / 8 ) * Table.RowCount( [Accelo Available Hours])

 

Next up to figure out filtering by group.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors