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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
godinbl
Frequent Visitor

Trying to establish relationship between values in 2 tables where 1 value is IN the other in PowerBi

I have 2 tables:  MeterReadings and Auths and a common field called auth

 

The MeterReadings data looks like this:

 

meterrefclientrefclientnamewmaauthreaddatereading
20476233141JAMES LINDSAY ROBINSONBurdekin Groundwater Management Area1006581/08/20240.063
20476233141JAMES LINDSAY ROBINSONBurdekin Groundwater Management Area1006581/08/20240.058
17408233141JAMES LINDSAY ROBINSONBurdekin Groundwater Management Area10065831/07/202464.809
17408233141JAMES LINDSAY ROBINSONBurdekin Groundwater Management Area10065816/06/202464.525
8572177132CATHERINE AGNES QUAGLIATA; LEO CHARLES ANDREW QUAGLIATABurdekin Groundwater Management Area 103387; 61866422/07/20226,389.93
8572177132CATHERINE AGNES QUAGLIATA; LEO CHARLES ANDREW QUAGLIATABurdekin Groundwater Management Area 103387; 61866413/06/20236,446.00
8572177132CATHERINE AGNES QUAGLIATA; LEO CHARLES ANDREW QUAGLIATABurdekin Groundwater Management Area103387; 61866410/06/20246,664.04
8971238641MARINA ANN MARSON; MICHAEL MARSONBurdekin Groundwater Management Area 17441330/06/20231,120.92
8971238641MARINA ANN MARSON; MICHAEL MARSONBurdekin Groundwater Management Area 17441328/06/20221,051.00
8971238641MARINA ANN MARSON; MICHAEL MARSONBurdekin Groundwater Management Area1744138/06/20241,249.10
15175172163ENRICO MIO; PAOLO MIO; MARIO MIOBurdekin Groundwater Management Area 175218; 62139025/07/2023911.281
15175172163ENRICO MIO; PAOLO MIO; MARIO MIOBurdekin Groundwater Management Area 175218; 6213904/07/2022895.487
15175172163ENRICO MIO; PAOLO MIO; MARIO MIOBurdekin Groundwater Management Area175218; 6213903/09/2024912.221
17400249245AUSTRALIAN CANE FARMS LIMITEDBurdekin Groundwater Management Area 175827; 6157623/07/20236,231.29
17400249245AUSTRALIAN CANE FARMS LIMITEDBurdekin Groundwater Management Area 175827; 61576220/06/20225,829.51
17400249245AUSTRALIAN CANE FARMS LIMITEDBurdekin Groundwater Management Area175827; 61576210/06/20246,622.37
17400249245AUSTRALIAN CANE FARMS LIMITEDBurdekin Groundwater Management Area175827; 61576212/02/20246,435.58
17400249245AUSTRALIAN CANE FARMS LIMITEDBurdekin Groundwater Management Area175827; 61576212/02/20246,435.54
15097241129JOSEPH LEON CALTABIANO; ROSA CALTABIANO; SALVATORE ALFIO NATALE CALTABIANOBurdekin Groundwater Management Area 176441; 61866830/06/2022878.924

 

notice that the auth field can have 1 auth or many auths - I am trying to create a relationship between my 2 tables where the auth value in the Auths table is IN the auth field in the MeterReadings table

 

my table in PowerBi looks like this:

godinbl_0-1731473418029.png

and you can see that when there are multiple auths it cannot calculate the value for Entitlement

 

This my code for the Entitlement field in the table:

 

Entitlement = 
VAR _auth = [Auth--auth]
VAR _zone = [Zone]
VAR _vol =
    CALCULATE (
        SUM ( 'Auths'[volumeML] ),
        'MeterReadings'[auth] = _auth )

VAR _amo =
    CALCULATE (
        SUM ( 'SWANs'[amount] ),
        'SWANs'[authorisation] = _auth,
        'SWANs'[expirydate] >= MIN ( 'MeterReadings'[readdate] ),
        'SWANs'[expirydate] <= MAX ( 'MeterReadings'[readdate] )
    )
VAR _thisyear =
    CALCULATE ( SUM ( 'AEs'[thisyear] ), 'AEs'[subcatchment] = _zone )
VAR _sumsd_pa =
    CALCULATE (
        SUM ( 'Auths'[SandDValue] ) + SUM ( 'Auths'[PAValue] ),
        'Auths'[Auth--auth] = _auth
    )
RETURN
    ( _vol + _amo ) * _thisyear + _sumsd_pa

 

 

this is not bringing up any errors but obviously this part of the code needs to be changed to account for multiple auths:

VAR _vol =
    CALCULATE (
        SUM ( 'Auths'[volumeML] ),
        'MeterReadings'[auth] = _auth )
 
I have already split the auth field in the Auths table so it contains single auths
any assistance with this much appreciated
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Your meterreadings table is missing a primary key, something that can uniquely identify each reading.

 

Then you are missing an auth dimension table

 

And finally you are missing the mapping table between reading IDs and auth values.

 

See attached for a solution proposal.

 

lbendlin_0-1731490738208.png

 

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

Your meterreadings table is missing a primary key, something that can uniquely identify each reading.

 

Then you are missing an auth dimension table

 

And finally you are missing the mapping table between reading IDs and auth values.

 

See attached for a solution proposal.

 

lbendlin_0-1731490738208.png

 

@lbendlin thanks for your response - my question to you was ambiguous and your answer therefore not a solution in itself but you mentioned primary keys and IDs mapping to each table and that was my problem - everything working now - THANK YOU!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors