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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
osavaso
Frequent Visitor

how to make relationship with two columns in BI data model

I have two tables with ATMs data and second table with transaction data made through this ATMs.

In ATM data table I have column with some attributes for each ATM.
In example such attributes is IND and OUTD. Also in this table I have SNAP_DATE for ATMs. ATM can change atribute depending on snap date.

In final result I want to receive connection between this two tables depending on: ATMs[ATM#]-->transaction data[ATM#] and ATMs[SNAP_DATE]-->transaction data[SNAP_DATE] to receive breakdown of transactions by IND and OUTD ATMs in months.

My problem is that I want to do this, without making any new merged unique columns.
if it's possible I want make relation between this two tables using just two source columns, which I mentioned above ATM# and SNAP_DATE.

please help me find solution if such exists. I'm new in Power BI so forgive me if I'm asking something stupid.

Thanks in advance.

 

ATM data Table:

ATM#IND/OUTDSNAP_DATE
ATM1IND9/30/2019
ATM2IND9/30/2019
ATM3OUTD9/30/2019
ATM4OUTD9/30/2019
ATM1OUTD10/31/2019
ATM2OUTD10/31/2019
ATM3IND10/31/2019
ATM4IND10/31/2019

 

transaction data table:

ATM#DATEVOLUMESNAP_DATE
ATM19/1/201919/30/2019
ATM29/2/201919/30/2019
ATM39/3/201929/30/2019
ATM49/4/201929/30/2019
ATM110/1/2019110/31/2019
ATM210/2/2019110/31/2019
ATM310/3/2019210/31/2019
ATM410/4/2019210/31/2019
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @osavaso

You can use TREATAS to create a virtual relationship in a measure.

 

Volumn TREATAS = 
CALCULATE(
    SUM('Transaction data'[VOLUME]),
    TREATAS (
        SUMMARIZE ( 'ATM data', 'ATM data'[ATM#], 'ATM data'[SNAP_DATE] ),
        'Transaction data'[ATM#],
        'Transaction data'[SNAP_DATE] 
    )
)

Then you can pull fields in from your 'ATM data' table and put this measure on the visual and it will apply the ATM# and SNAP_Date as filters in the measure.

ATMMeasure.jpg

This works even with no relationship between the tables.  The down side is it can be slower than the physical relationship you would get from the comined column you mention.

ATMModel.jpg

I have attached my sample file you to look at.

 

If this solves your issues please mark it as the solution. Kudos 👍 are nice too.

View solution in original post

3 REPLIES 3
jdbuchanan71
Super User
Super User

Hello @osavaso

You can use TREATAS to create a virtual relationship in a measure.

 

Volumn TREATAS = 
CALCULATE(
    SUM('Transaction data'[VOLUME]),
    TREATAS (
        SUMMARIZE ( 'ATM data', 'ATM data'[ATM#], 'ATM data'[SNAP_DATE] ),
        'Transaction data'[ATM#],
        'Transaction data'[SNAP_DATE] 
    )
)

Then you can pull fields in from your 'ATM data' table and put this measure on the visual and it will apply the ATM# and SNAP_Date as filters in the measure.

ATMMeasure.jpg

This works even with no relationship between the tables.  The down side is it can be slower than the physical relationship you would get from the comined column you mention.

ATMModel.jpg

I have attached my sample file you to look at.

 

If this solves your issues please mark it as the solution. Kudos 👍 are nice too.

Thank you very much! This is exactly what I wanted.

 

One more question. As I understand there is no way to do this by physical relationships between tables? I mean we can't use two connections between two same tables, yes?

That is correct, you can only have one active relationship between tables.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors