Forum Discussion

Andries_Benade's avatar
Andries_Benade
New Member
3 years ago
Solved

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?

6 Replies

  • KNP's avatar
    KNP
    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.

     

  • KNP's avatar
    KNP
    Super User

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

     

    • Andries_Benade's avatar
      Andries_Benade
      New Member

      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