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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
defisher
New Member

Mapping Trouble with One to Many Relationship

I have a purchase table that contains a tax1 and tax2 field for each purchase of a specific item. This table is the only source for the tax1 and tax2 fields.
I also have a lookup table that contains the base price of each item.
I have these tables connected in a one to many relationship on an "item id" field.
I want to do some kind calculated column/measure in my lookup table such as "tax1_lookup = calculate(min(tax1), purchases.item_id = lookup.item_id)". The idea is I just want to grab of the tax values from the purchases table so I can move that field to my lookup table. Perferably, I would like to get the tax value for the most recent purchase (using purchase date) for each serial number, but just getting any of the tax values would be good enough to start.

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @defisher,

 

Add a calculated column in purchase table.

most recent tax1 =
CALCULATE (
    MAX ( Purchase[tax1] ),
    FILTER (
        ALLEXCEPT ( Purchase, Purchase[Itemid] ),
        Purchase[Date]
            = CALCULATE ( MAX ( Purchase[Date] ), ALLEXCEPT ( Purchase, Purchase[Itemid] ) )
    )
)

1.PNG

 

Add a calculated column in LookUp table.

Tax1 = LOOKUPVALUE(Purchase[most recent tax1],Purchase[Itemid],Lookup[Itemid])

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @defisher,

 

Add a calculated column in purchase table.

most recent tax1 =
CALCULATE (
    MAX ( Purchase[tax1] ),
    FILTER (
        ALLEXCEPT ( Purchase, Purchase[Itemid] ),
        Purchase[Date]
            = CALCULATE ( MAX ( Purchase[Date] ), ALLEXCEPT ( Purchase, Purchase[Itemid] ) )
    )
)

1.PNG

 

Add a calculated column in LookUp table.

Tax1 = LOOKUPVALUE(Purchase[most recent tax1],Purchase[Itemid],Lookup[Itemid])

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.