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