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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

Lookupvalue with multiple results, filter the right one without unique identifier

Hi all,

I have an database with 2 tables. Adres and AdresHistory. When the adres changes, the old address is copied to AdresHistory with the AdresID from Adres. In AdresHistory there is also a Start- and Enddate column (they do not overlap). 

 

How to get the unique row AdresHistory data based on that dates? I need this unique one for a LOOKUPVALUE to get the actual Adres on a specific date. AdresHistory does not have a unique ID, but the tables are related.

 

The formula i'm now using:

_woonplaats =

if(Verrichting[_uitvoerDatum].[Date] >= Verrichting[_woonplaatsDatum].[Date],
LOOKUPVALUE(Adres[plaats],Adres[adresId],Verrichting[__getAdresid]),

LOOKUPVALUE(AdresHistory[plaats],AdresHistory[I'm looking for this, based on dates],Verrichting[__getAdresid]))

 

powerbi.png

 

Thanks in advance.

 

Kind regards,

Jelle

 
 
1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @jelleschuurman 

 

Not sure what's your data model like, you may refer to below measure to get a specific address during a period from AddressHistory table.

OperationAddressHistory = 
MAXX (
    FILTER (
        ALL ( AddressHistory ),
        AddressHistory[AddressId] = MAX ( Operations[AddressId] )
            && AddressHistory[Start Date] <= MAX ( Operations[OperationDate] )
            && AddressHistory[End Date] >= MAX ( Operations[OperationDate] )
    ),
    AddressHistory[Address]
)

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors