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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Sullyball2a
Frequent Visitor

Simplify DAX to get a listing of customers

I have a table where there are multiple customer records Table 1 and a table of customers I want to exclude from my results Table2. Tables 1 & 2 are joined in my data model: many to one.

I want a listing (no duplicates) of customers from Table 1 not in Table 2

The DAX I have written to achieve this is:

DEFINE

 VAR MyDetailTbl =

 CALCULATETABLE(

    SELECTCOLUMNS('Table 1'

    ,"Customer Number", 'Table 1'[Customer No]

    ,"isDup", RELATED(Table2[Customer No])

    )

)

 

VAR MySummaryTbl =

GROUPBY(MyDetailTbl, [Customer Number],[isDup])

 

EVALUATE

SELECTCOLUMNS(FILTER(MySummaryTbl, ISBLANK([isDup])),"Customer No", [Customer Number])

 

This seems over complicated. Is there a more straightforward way to achieve this?

2 ACCEPTED SOLUTIONS
Selva-Salimi
Super User
Super User

Hi @Sullyball2a ,

 

Yes, you can rewrite it as follows :

 

except( distinct('Table 1'[Customer No]), distinct( 'MyDetailTbl'[Customer Number]))

 

If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly. 

 

View solution in original post

Sullyball2a
Frequent Visitor

Thank you  - I knew there had to be a more simple way. I wasn't aware of the EXCEPT() or DISTINCT() functions. I was aware of VALUES() and I tried it with that instead of DISTINCT() and it worked too.

View solution in original post

2 REPLIES 2
Sullyball2a
Frequent Visitor

Thank you  - I knew there had to be a more simple way. I wasn't aware of the EXCEPT() or DISTINCT() functions. I was aware of VALUES() and I tried it with that instead of DISTINCT() and it worked too.

Selva-Salimi
Super User
Super User

Hi @Sullyball2a ,

 

Yes, you can rewrite it as follows :

 

except( distinct('Table 1'[Customer No]), distinct( 'MyDetailTbl'[Customer Number]))

 

If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly. 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.