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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Adidas
Helper I
Helper I

Calculating a dynamic anti join table

I have two tables in my power bi model:
a. SalesFact table which contains sales per employee by dates and b.SalesEmployees which hold the salesperson's details
My goal is to show for each date a list of the salesperson with no sales on that date. (page has date slicer)
to calculate this "anti join" table I wrote this table function:
antijoin table =
EXCEPT (
SELECTCOLUMNS ( SalesPersons, "ID", SalesPersons[worker id] ),
SELECTCOLUMNS ( 'Salesfact', "ID", 'Salesfact'[worker id] )
)

The problem here is that the function does not take the user selection of date slicer into consideration
meaning it is calculating the anti join between the whole SalesFact table and SalesEmployees table regardless of the date chosen
how can I achieve my desired goal?

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @Adidas ,

 

I think this is what you want.

 

Pbix file is attached with the solution

 

https://community.powerbi.com/t5/Desktop/Count-of-Customers-with-no-Sales/td-p/589155

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

6 REPLIES 6
harshnathani
Community Champion
Community Champion

Hi @Adidas ,

 

I think this is what you want.

 

Pbix file is attached with the solution

 

https://community.powerbi.com/t5/Desktop/Count-of-Customers-with-no-Sales/td-p/589155

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Thank you all for your kind help

it works fine now

amitchandak
Super User
Super User

@Adidas , you can use inside a measure, but costly stuff for measure

 

antijoin table =

countx(
EXCEPT (
SELECTCOLUMNS ( SalesPersons, "ID", SalesPersons[worker id] ),
SELECTCOLUMNS ( 'Salesfact', "ID", 'Salesfact'[worker id] )
) ,[worker id] )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks amitchandak

measure =
countx(
EXCEPT (
SELECTCOLUMNS ( SalesPersons, "ID", SalesPersons[worker id] ),
SELECTCOLUMNS ( 'Salesfact', "ID", 'Salesfact'[worker id] )
) ,[ID] )
 
How can I show now the list of employees with no daily sales?

 

Adidas
Helper I
Helper I

Hi

forgot to mention I'm on a direct query mode
cant use the query editor here

I should perform it by pure dax

harshnathani
Community Champion
Community Champion

Hi @Adidas ,

 

See if these help you 

 

https://radacad.com/how-to-change-joining-types-in-power-bi-and-power-query#:~:text=In%20Power%20BI%...

 

https://curbal.com/blog/joining-table-in-power-bi-with-power-query-and-dax

 

https://www.tutorialgateway.org/joins-in-power-bi/

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

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.