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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ovetteabejuela
Impactful Individual
Impactful Individual

Retrieve a value of a column from another table

Hi All,

 

Thanks to this community I've learned how to implement this using crossjoin, however what if I need to retrieve the value to a column of an existing table(Transaction Table)  and not from a new table generated by a Join(crossjoin)

Also, I think it's NOT possible to create a relationship between Transaction Table and Rates Table

 

For example on Transaction Table I want to retrieve the applicable rate for 12/1/2016 which should be 5.5.

 

Transaction DateHistorical Rate(s) <<< Transaction Table | Rates Table >>> Effective Start DateEffective End DateRate
12/1/2016  <<< Transaction Table | Rates Table >>> 12/1/201612/4/20165.5
12/2/2016  <<< Transaction Table | Rates Table >>> 12/5/201612/9/20167.8
12/3/2016  <<< Transaction Table | Rates Table >>> 12/10/201612/14/20166.7
12/4/2016  <<< Transaction Table | Rates Table >>>    
12/5/2016  <<< Transaction Table | Rates Table >>>    
12/6/2016  <<< Transaction Table | Rates Table >>>    
12/7/2016  <<< Transaction Table | Rates Table >>>    
12/8/2016  <<< Transaction Table | Rates Table >>>    
12/9/2016  <<< Transaction Table | Rates Table >>>    
12/10/2016  <<< Transaction Table | Rates Table >>>    
12/11/2016  <<< Transaction Table | Rates Table >>>    
12/12/2016  <<< Transaction Table | Rates Table >>>    
12/13/2016  <<< Transaction Table | Rates Table >>>    
12/14/2016  <<< Transaction Table | Rates Table >>>    
1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

@ovetteabejuela

First perform these steps in the Query Editor

1) Select the 2 date columns and change data type to whole number

2) add a custom column as in the attached image ={ .. }

3) expand to new rows and rename

4) convert back to dates

5) close and apply

 

Query Editor - List of Dates.gif

 

then create this COLUMN in your Transactions table (no relationship needed)

 

Historical Rate COLUMN =
LOOKUPVALUE (
    'Rates Table'[Rate],
    'Rates Table'[Date], 'Transactions Table'[Transaction Date]
)

and here's the result Smiley Happy

 

LookupValue - Rate by Day.png

 

Hope this helps! Smiley Happy

View solution in original post

6 REPLIES 6
androo235
Advocate I
Advocate I

Thanks and the animations are useful, except, and this may be nothing to do with you, once they are running they endlessly repeat and there appears to be no way to pause them or know if you are looking at the begining middle or end of the animation.

Sean
Community Champion
Community Champion

@ovetteabejuela

First perform these steps in the Query Editor

1) Select the 2 date columns and change data type to whole number

2) add a custom column as in the attached image ={ .. }

3) expand to new rows and rename

4) convert back to dates

5) close and apply

 

Query Editor - List of Dates.gif

 

then create this COLUMN in your Transactions table (no relationship needed)

 

Historical Rate COLUMN =
LOOKUPVALUE (
    'Rates Table'[Rate],
    'Rates Table'[Date], 'Transactions Table'[Transaction Date]
)

and here's the result Smiley Happy

 

LookupValue - Rate by Day.png

 

Hope this helps! Smiley Happy

is there any way to do this power query ?

Anonymous
Not applicable

Hi,

 

I tested with this condition as "lookup". It works. And now, I would like to test with the "IF" instead of "LOOKUP" in power BI Query and no Desktop, because, I would like to test with the 2 values ​​"min" and "max".

For instance : 

Table A                             Table B

Column Age                    Code1    Min     Max    Desc

0                                        Age       0          2       between 0 and 2 years old

2                                        Age       3        10       between 3 and 10 years old.       

5

 

Table A.ColumnA  > TableB. Column "Min" and Table A.ColumnA  > TableB. Column "Max" with table.Code1 ="Age"

value of return  : Desc 

 

How to do it ?

 

Thank you in advance for your answer

 

 

That is pretty cool


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

ovetteabejuela
Impactful Individual
Impactful Individual

Hahaha, I learned something new again...

 

Thank you @Sean, another clever way to solve my problem - this has been troubling me for almost a day now and I think what you've showed is the solution!

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

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