Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
abzt
New Member

Dax - Show difference between two related columns in different tables

I have two columns of data for Emplolyees - linked via Employee ID

 

Table 1 - Shows the employeees who have booked on for a particular date range (Emp ID/ First Name/ Last Name/Work Date/Hours)

 

Tabel 2 - Is the listing of ALL company employees (Emp ID/ First Name/ Last Name)

 

Outcome - I am trying to get an output of the employees from Table 2 that do not feature in the Table 1 lisitng for the chosen sliced date range

1 ACCEPTED SOLUTION

Create a measure like

Emp is visible =
IF (
    SELECTEDVALUE ( 'Table 2'[Employee ID] )
        IN EXCEPT ( VALUES ( 'Table 2'[Employee ID] ), VALUES ( 'Table 1'[Employee ID] ) ),
    1,
    0
)

and add that as a visual level filter to only show when the value is 1

View solution in original post

8 REPLIES 8
abzt
New Member

Thank you very much I now have the desired results

johnt75
Super User
Super User

Use the columns from table 2 in the visual and add a filter so that 'Table 1'[Employee ID] is blank.

Thank you for your response, following those steps however there are no blank values displaying in the filter listing for the visual as an option or returning if I choose "is blank" , I know I am expecting 40 records

You could create a measure as COUNTROWS('Table 1') and filter for values >= 1.

I'm not sure what Im doing wrong but I can't get to a list of those who have not booked on, the measure only shows those who have booked again i cant get to the blanks

Just for debugging try creating a new table like

Tmp table =
CALCULATETABLE (
    EXCEPT ( VALUES ( 'Table 2'[Employee ID] ), VALUES ( 'Table 1'[Employee ID] ) ),
    DATESBETWEEN ( 'Date'[Date], DATE ( 2023, 1, 1 ), DATE ( 2023, 1, 31 ) )
)

replacing the start and end dates with what you have chosen from the slicer.

That seems to display the values I am looking for on the non-bookers, how can I incorporate that into the report?

Create a measure like

Emp is visible =
IF (
    SELECTEDVALUE ( 'Table 2'[Employee ID] )
        IN EXCEPT ( VALUES ( 'Table 2'[Employee ID] ), VALUES ( 'Table 1'[Employee ID] ) ),
    1,
    0
)

and add that as a visual level filter to only show when the value is 1

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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