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 August 31st. Request your voucher.

Reply
Andries_Benade
New Member

Reference a column from another table in Power Query Editor new column function/query

I want to add a column that counts the number of items that has the foreign ID in one of the corresponding row ID in another table using Power Query Editor and a formula. The formula I improvised is: List.Count(List.Select([Device.ID],[Device.ZoneID]=[ID]))

 

It just throws out an error as I expected since the Device.ID and Device.ZoneID columns aren't found. How do I accomplish this?

1 ACCEPTED SOLUTION
KNP
Super User
Super User

Thanks for the data. That makes it much easier.

I'd probably tackle it with a merge.

See attached PBIX file. 

Let me know if you have questions.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

View solution in original post

6 REPLIES 6
KNP
Super User
Super User

Thanks for the data. That makes it much easier.

I'd probably tackle it with a merge.

See attached PBIX file. 

Let me know if you have questions.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x
KNP
Super User
Super User

Any chance you could paste the data in a table instead of screenshots?

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

Device

IDDevice NameCategory IDZone IDStatusIs ActiveDate Installe
D01Front-door CameraCameraTerrazzoActiveTRUE1/25/2020
D02Boiler TempTemperature SensorBoilermaker RoomInactiveTRUE2/2/2021
D03Speed TestingSpeed SensorSafety OfficeActiveTRUE12/11/2021
D04Entry AccessAccess ControlStucco Mason BuildingActiveTRUE3/21/2022
D05Exit AccessAccess ControlStucco Mason BuildingInactiveFALSE3/21/2022
D06Light ActivationMotion SensorLabor OfficeInactiveFALSE5/17/2021
D07Front-door CameraCameraEnvironmental OfficeActiveTRUE8/1/2021
D08Aircon ActivationMotion SensorTile Setting BenchInactiveFALSE8/26/2021
D09Assembly TempTemperature SensorLinemen AssemblyInactiveFALSE1/23/2022

 

Zone

IDZoneNameZoneDescription
Z01Terrazzo13-175 - Ice Rinks
Z02Boilermaker Room2-870 - Sculpture/Ornamental
Z03Safety Office17-030 - Bond
Z04Stucco Mason Building2-750 - Concrete Pads and Walks
Z05Iron Workshop3-400 - Precast Concrete
Z06Labor Office1-523 - Sanitary Facilities
Z07Environmental Office2-370 - Erosion and Sedimentation Control
Z08Tile Setting Bench1-570 - Temporary Controls
Z09Linemen Assembly2-825 - Wood Fences and Gates
KNP
Super User
Super User

Can you please provide some sample (mock-up) data from each of the two tables?

It'll be much easier to help with something to work with.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

I made a new query/function that seems to better express what I want to do (Device Count)

Screenshot (133).png

Device

Device.png

 

Zone

Zone.png

  

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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