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
coollehavre
Frequent Visitor

lookup value in dax with bracket value

Hi, i have a table with number of days and i would like to display a sentence based on another table

It's easy to do this with VLOOKUP in Excel, but in DAX, how to do ?

 

Capture.PNG

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @coollehavre,


You can try to use below formula to create a calculate column to search the range label from other table.

Range =
VAR day_index =
    MAXX (
        FILTER ( ALL ( 'TableB'), 'TableB'[Days] < EARLIER ( 'TableA'[Days] ) ),
        [Days]
    )
RETURN
    LOOKUPVALUE ( 'TableB'[Range], 'TableB'[Days], day_index )

2.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @coollehavre,


You can try to use below formula to create a calculate column to search the range label from other table.

Range =
VAR day_index =
    MAXX (
        FILTER ( ALL ( 'TableB'), 'TableB'[Days] < EARLIER ( 'TableA'[Days] ) ),
        [Days]
    )
RETURN
    LOOKUPVALUE ( 'TableB'[Range], 'TableB'[Days], day_index )

2.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Try this:

 

=
LOOKUPVALUE ( TableB[Libelle], TableB[Delai], VALUES ( TableA[Delai] ) )

This will be a MEAUSURE, not a calculated column.  If you want a column, you can do this:

 

=
LOOKUPVALUE ( TableB[Libelle], TableB[Delai], TableA[Delai]  )

You don't need the VALUES() function in the calculated column because you have a row context in Table A to get you the right value in the [Delai] column.  In the measure, you need VALUES() to get the proper scalar value from [Delai] column based on the current filter context.

 

Hope this helps!

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.