Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi all. I have a table in Power BI (employee table). This table obviously contains data such as employee number, name, email, etc. It also has hire and termination date. The Hire_Date and Termination_Date columns have a relationship with my date table. Hire_Date is currently the active relationship. This employee table has 139 rows (as seen in the lower left hand corner of the screen when in Table View mode. I don't know if it is relevant or not, but this employee table has a one-to-many connection from it to to a time tracking table (single direction filtering). This time tracking table has a many-to-many to a project table (both direction filtering).
My issue is that I have been getting odd results when creating measures using the employee table - essentially results that are larger than expected (verified by bringing in my data into excel and manually applying filters). As part of my troubleshooting, I went with some simple count measures and am getting inconsistent results. I am particularly perplexed by how one of my formulas returns a number that is 1 greater (140) than the total rows in my table. Below are the DAX measures that I am using and their associated results:
The first measure returns what I am expecting (139 - the total number of rows in my table).
Solved! Go to Solution.
Inactive Relationships or Unrelated Rows: Sometimes, ALL can expose rows that are not normally visible due to relationships or filtering in the model. Check if there are any inactive relationships or rows in the employee table that might not have proper connections to related tables.
Duplicate Rows: Even though your employee table shows 139 rows, there might be a hidden duplicate or some data integrity issue causing ALL to pick an extra row.
Row Context: When using ALL, it removes all filters from the employee table, including those applied by related tables. This could result in a scenario where a row appears more than once due to the context of relationships.
Verify Data Integrity: Check your employee table for any hidden or duplicate rows that might not be visible in Power BI but exist in the underlying data source.
Inspect Relationships: Ensure that all relationships between your tables are correctly set up and there are no inactive or ambiguous relationships causing unexpected results.
Check for Unrelated Rows: Create a measure to identify if there are any rows in the employee table that do not have corresponding related data:
Row-Level Filters: Test if there are any row-level filters affecting your count by creating a table visual and manually inspecting the rows.
If you want to ensure you count only the rows visible in the current filter context without exposing potential unrelated or hidden rows, you can use a measure like:
This measure would give you the count of rows after removing all filters, but it shouldn't expose hidden rows due to ALL.
Inactive Relationships or Unrelated Rows: Sometimes, ALL can expose rows that are not normally visible due to relationships or filtering in the model. Check if there are any inactive relationships or rows in the employee table that might not have proper connections to related tables.
Duplicate Rows: Even though your employee table shows 139 rows, there might be a hidden duplicate or some data integrity issue causing ALL to pick an extra row.
Row Context: When using ALL, it removes all filters from the employee table, including those applied by related tables. This could result in a scenario where a row appears more than once due to the context of relationships.
Verify Data Integrity: Check your employee table for any hidden or duplicate rows that might not be visible in Power BI but exist in the underlying data source.
Inspect Relationships: Ensure that all relationships between your tables are correctly set up and there are no inactive or ambiguous relationships causing unexpected results.
Check for Unrelated Rows: Create a measure to identify if there are any rows in the employee table that do not have corresponding related data:
Row-Level Filters: Test if there are any row-level filters affecting your count by creating a table visual and manually inspecting the rows.
If you want to ensure you count only the rows visible in the current filter context without exposing potential unrelated or hidden rows, you can use a measure like:
This measure would give you the count of rows after removing all filters, but it shouldn't expose hidden rows due to ALL.
Thank You. I tried the UnrelatedEmployeeCount formula that you provided and when it came to add the related table/field to the expression, I received an error message saying "The column 'TimeTracking'[FK_Employee] either doesn't exist or doesn't have a relationship to any table available in the current context". Odd considering I have a direct connection from the Employee Table to the column that I referenced in the formula.
One of my other troubleshooting measures that also uses ALL does provide the expected result of 139, which is leading to part of my confusion. That DAX formula is:
User | Count |
---|---|
84 | |
76 | |
74 | |
48 | |
39 |
User | Count |
---|---|
114 | |
56 | |
51 | |
42 | |
42 |