Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I’m working on a Power BI report and need assistance with combining forecasted and actual space data, while ensuring the ability to filter the data by Kostenstelle (department). Below is my data model setup and the approach I’m using:
I have a few key tables in my model:
dimNutzerstructure (dimension table containing user categories):
Example entries:
| Kostenstelle | Subdepartment | Department |
| 021102 | Financial_1 | Banking |
| 021103 | Financial_2 | Banking |
| 011112 | Personal | HR |
2. ExportRDB (room data):
Example entries:
| RoomID | Kostenstelle | Fläche in m² (area) | DIN277-1 (type) |
| 1 | 021102 | 10 | NUF2 |
| 2 | 021102 | 20 | NUF4 |
| 3 | 011112 | 15 | NUF2 |
3. factPersonaltapete (user data):
Example entries:
| Kostenstelle | Name | Department |
| 021102 | John Doe | Banking |
| 011112 | Max Mustermann | HR |
I am using the following measures to calculate space needs for each user category:
Bürobedarf (forecasted office space):
Bürobedarf =
SUMX(
VALUES('factPersonaltapete'[MA-Kategorie]),
[Anzahl Angestellte] *
LOOKUPVALUE(
'Bueroflaechenrichtwerte'[Büro - Richtwert, m²],
'Bueroflaechenrichtwerte'[Dienstbezeichnung],
'factPersonaltapete'[MA-Kategorie]
)
)
2. Anzahl Angestellte (number of employees):
Anzahl Angestellte = COUNTROWS('factPersonaltapete')
3. Lagerbedarf (forecasted storage space):
Lagerbedarf = [Bürobedarf] * 0.05
To get the actual amount of office and storage space, I calculate the sum of the Fläche in m² column from the ExportRDB table, categorized by the DIN277-1 column (with values NUF2 for office space and NUF4 for storage space).
I created a ComparisonTable using UNION to combine forecasted and actual space data:
ComparisonTable =
UNION(
ROW("Category", "Office Space", "Forecasted", [Bürobedarf], "Actual", SUMX(FILTER('Export RDB', 'Export RDB'[DIN277-1] = "NUF2"), 'Export RDB'[Raum - Fläche in m²])),
ROW("Category", "Storage Space", "Forecasted", [Lagerbedarf], "Actual", SUMX(FILTER('Export RDB', 'Export RDB'[DIN277-1] = "NUF4"),'Export RDB'[Raum - Fläche in m²])),
ROW("Category", "Laboratory Space", "Forecasted", [Gesamt Laborbedarf], "Actual", SUMX(FILTER('Export RDB', 'Export RDB'[DIN277-1]= "NUF3"), 'Export RDB'[Raum - Fläche in m²])
))
I am unable to filter this visual with the Kostenstelle column to display both the used and forecasted space for each department.
Solved! Go to Solution.
Hi @Gruja
ComparisonTable is a calculated table. A calculated table cannot be filtered by filters or slicers in the report. You can consider its data is static when you interact with the report.
To have a dynamic result displayed, you need to use a measure to populate the column visual.
A common practice is to add an additional table which has category values to be displayed on x-axis. For example, table 'DimCategory':
Create measures to calculate the Forecasted value and Actual value separately. For example,
Forecasted =
SWITCH(
SELECTEDVALUE('DimCategory'[Category]),
"Office Space", [Bürobedarf],
"Storage Space", [Lagerbedarf],
"Laboratory Space", [Gesamt Laborbedarf]
)Actual =
SWITCH(
SELECTEDVALUE('DimCategory'[Category]),
"Office Space", SUMX(FILTER('Export RDB', 'Export RDB'[DIN277-1] = "NUF2"), 'Export RDB'[Raum - Fläche in m²]),
"Storage Space", SUMX(FILTER('Export RDB', 'Export RDB'[DIN277-1] = "NUF4"),'Export RDB'[Raum - Fläche in m²]),
"Laboratory Space", SUMX(FILTER('Export RDB', 'Export RDB'[DIN277-1]= "NUF3"), 'Export RDB'[Raum - Fläche in m²])
)
Place the new 'DimCategory' table's [Category] column to X-axis, and place the two new measures to Y-axis.
Hope this would be helpful.
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
Hi @Gruja
ComparisonTable is a calculated table. A calculated table cannot be filtered by filters or slicers in the report. You can consider its data is static when you interact with the report.
To have a dynamic result displayed, you need to use a measure to populate the column visual.
A common practice is to add an additional table which has category values to be displayed on x-axis. For example, table 'DimCategory':
Create measures to calculate the Forecasted value and Actual value separately. For example,
Forecasted =
SWITCH(
SELECTEDVALUE('DimCategory'[Category]),
"Office Space", [Bürobedarf],
"Storage Space", [Lagerbedarf],
"Laboratory Space", [Gesamt Laborbedarf]
)Actual =
SWITCH(
SELECTEDVALUE('DimCategory'[Category]),
"Office Space", SUMX(FILTER('Export RDB', 'Export RDB'[DIN277-1] = "NUF2"), 'Export RDB'[Raum - Fläche in m²]),
"Storage Space", SUMX(FILTER('Export RDB', 'Export RDB'[DIN277-1] = "NUF4"),'Export RDB'[Raum - Fläche in m²]),
"Laboratory Space", SUMX(FILTER('Export RDB', 'Export RDB'[DIN277-1]= "NUF3"), 'Export RDB'[Raum - Fläche in m²])
)
Place the new 'DimCategory' table's [Category] column to X-axis, and place the two new measures to Y-axis.
Hope this would be helpful.
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
Hi @Gruja ,
You cannot use measures in Tables, measure are calculated at the time of the visualzaion call and are based on context so they are calculated at need.
When you add a measure to a physical table the context is not consider properly sinvce you change your filter context so they are not properly calculated.
Please check this link with explanation about measures and columns
https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThe Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 61 | |
| 46 | |
| 40 | |
| 38 | |
| 22 |
| User | Count |
|---|---|
| 178 | |
| 133 | |
| 118 | |
| 82 | |
| 56 |