cancel
Showing results for
Did you mean:
Highlighted
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 ?

1 ACCEPTED SOLUTION

Accepted Solutions
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 )
```

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
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

## 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 )
```

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: | |

Announcements

#### Back to School Contest

Engage and empower students with Power BI!

#### Watch Sessions On Demand!

Continue your learning in our online communities.

#### Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

Top Ideas
Top Kudoed Authors
Users Online
Currently online: 402 members 4,066 guests
Recent signins: