Forum Discussion
Index Match - Match row datas with table header
- Anonymous7 years ago
Currency Table unpivot no relation now
Thanks for help. As suggested by you, I have unpivot the table as below: But unable to write the lookup formulae- As I need to match date as well as currency before picking up the value. Could you help me with the formulae.
Anonymous set relationship between currency and data table on date, where currency table will be on one side of the relationship.
Add following column:
FX Rate = SWITCH( DataTable[Currency], "OMR", RELATED( CurrencyTable[OMR] ), "USD", RELATED( CurrencyTable[USD] ), "EURO", RELATED( CurrencyTable[EURO] ) )
This is one way to do this, other way would be to unpivot currency table and then use lookup.
Thanks. Great. It helps. Is there any other way that it reads the Currency abreviations like OMR, USD etc and match it. As my table has several currencies and more than 3650 dates.
- parry2k7 years ago
Super User
Anonymous in thst case you have to unpivot your currency table, to do so, go to query editor, select date column in currency table, right click, and select unpivot other columns. You will get two columns attribute and value, rename those to currency and rate.
Once these changes are applied, we don't need to set relationship between currency and sales table but use lookupvalue function, read here about this function.
- Anonymous7 years agoNot applicable
Currency Table unpivot no relation now
Thanks for help. As suggested by you, I have unpivot the table as below: But unable to write the lookup formulae- As I need to match date as well as currency before picking up the value. Could you help me with the formulae.
- parry2k7 years ago
Super User
Anonymous here it is, add a column in data table
FX Rate = LOOKUPVALUE
( CurrencyTable[Value], CurrencyTable[Date], DataTable[Date], CurrencyTable[Currency], DataTable[Currency] )
- Anonymous7 years agoNot applicable
Thanks a lot.