cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
coollehavre Frequent Visitor
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

Accepted Solutions
Community Support Team
Community Support Team

Re: lookup value in dax with bracket value

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 Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
2 REPLIES 2
ChrisHaas Established Member
Established Member

Re: lookup value in dax with bracket value

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!

Community Support Team
Community Support Team

Re: lookup value in dax with bracket value

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 Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |

Helpful resources

Announcements
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

Top Ideas
Users Online
Currently online: 402 members 4,066 guests
Please welcome our newest community members: