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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
dnl_8
New Member

Overwrite relationship filter to get other Sales

Hi,

I am wondering how can I do the following:

I have a table:
Card

CardIDCompanyID
Card1Company1
Card2

Company2

 

Sales

Card IDCustomer IDSales
Card1Customer110
NoCardCustomer15
Card1Customer220
NoCardCustomer210

 

 

I would like to be able to calculate the following:

I select Company1 from the Card table, and I want to be able to say that Customer1 and Customer2 ( who used Card1 which belongs to Company1) had 5 and 10 sales with NoCard ID.

So generally, I would like to get the Customer's NoCard sales, and link it to the companny whose card they used for Card1-Customer1-10 and Card1-Customer2-20 Sales rows.

So the wished outcome would be
Company1 - NoCard- 15Sales

 

I am able to join the 2 tables on CardID, but generally that only filters the Card transactions, where there is NoCard, it does not calculate.

 

Thank you!

2 REPLIES 2
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

i think what you need to do is create a link table, use power query to duplicate/reference the sales table and remove all the no card rows and the sales column as below:

 

DOLEARY85_0-1680442238819.png

 

then set your model to have an inactive relationship from this link table to the sales table on customer id,

 

you should then be able to use this measure:

 

Measure 5 = calculate(sum(Sales[Sales]),USERELATIONSHIP('Sales Link'[Customer ID],Sales[Customer ID]))
 
the table will have the company ID from the card table, card id from the sales table and the measure which i put in the sales table.
 
DOLEARY85_1-1680442415471.png
 
hope this helps
Greg_Deckler
Community Champion
Community Champion

@dnl_8 You need to use ALL to bring all of the rows into context and then filter for NoCard. Like this:

No Card = 
    VAR __Customers = DISTINCT('Table2'[Customer ID])
    VAR __Table = FILTER(ALL('Table2'), Table2[Customer ID] IN __Customers && 'Table2'[Card ID] = "NoCard")
    VAR __Result = SUMX(__Table, [Sales])
RETURN
    __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.