**Automating Seat Assignments in Office Buildings: A Power BI Approach**
In many office environments, managing seat assignments efficiently is essential for space optimization and resource planning. This article explores a real-world scenario where an organization needed to assign unassigned seats based on departmental ownership, using Power BI as the primary tool. The author outlines the business rules, technical challenges, and eventual solution using DAX after encountering limitations with Power Query.
—
### **The Scenario**
Each seat in the office building must be assigned to an organizational unit (OU). A master list contains all seats, with some lacking an assigned OU. The rule is to assign all unassigned seats to the OU that owns the most seats, applied **by room and then by floor**.
For example, in Room B, if “OU 3” owns the most seats, all unassigned seats in that room go to OU 3. However, if an entire floor has unassigned seats, the OU with the most seats across **all rooms** on that floor takes those seats.
—
### **The Data Source**
Seat data is stored in monthly Excel files named with a date prefix (e.g., `20260331_Seatlist.xlsx`). Only the latest file is relevant for assignment. Each file contains seat numbers, room numbers, and current OU assignments.
—
### **Initial Approach: Power Query**
The author initially implemented the logic in Power Query using an M-function. Steps included:
1. Finding the latest file
2. Reading seat data for the current row
3. Counting seats per OU in the same room
4. Sorting and selecting the top OU
While this worked locally, **two major issues** emerged:
– **Performance dropped drastically** with network-based sources (SharePoint or shared folders), due to repeated function calls and network latency.
– **Dynamic data sources are not allowed in Power Query** when published to Power BI Service, causing the solution to fail post-publishing.
After attempting workarounds without success, the author abandoned the Power Query approach.
—
### **Revised Approach: DAX**
Switching to DAX allowed the solution to work both in Desktop and Service. Two calculated columns were created:
1. **IsNewestFile** – Identifies the latest dataset using the file date.
2. **Assigned OU by Room** – Uses DAX to:
– Filter seats in the same room
– Count seats per OU
– Break ties using OU name
– Select the OU with the most seats
A second column, **Assigned OU by Floor**, applies the same logic at the floor level.
Finally, a **Seat Assignment OU** column uses a `SWITCH` statement to apply:
– Room-level assignment if available
– Floor-level assignment otherwise
– Original assignment if already present
This method proved reliable and performant in the cloud.
—
### **FAQ**
**Q: Why not use Power Query instead of DAX?**
A: Power Query failed due to performance issues with network sources and restrictions on dynamic data sources in Power BI Service. DAX provided a more stable and scalable solution.
**Q: How are ties handled when multiple OUs have the same number of seats?**
A: A secondary sort using the OU name ensures only one result is returned, preventing ambiguity.
**Q: Can this solution work with real-time data?**
A: Yes, as long as the data source is supported and refreshed properly in Power BI Service.
**Q: What are intermediary columns used for?**
A: They store intermediate calculation results (e.g., OU by room, OU by floor) before final assignment. These can be hidden or placed in a dedicated folder to avoid misuse.
—
### **Conclusion**
This project highlights an important lesson in data modeling: the “right” way isn’t always the best way. While Power Query is ideal for early-stage transformations, certain limitations—especially around cloud execution and dynamic sources—make DAX a better choice in some cases.
The author emphasizes learning from missteps and adapting strategies based on practical constraints. Understanding tool limitations helps avoid rework and leads to more resilient solutions. Ultimately, flexibility and experience guide better decision-making than rigid adherence to convention.
—
**References**
The data used in this article is fictional and created for demonstration purposes. No real-world organizations or datasets are referenced. For more on DAX context transition, refer to further learning resources on the topic.



