Forum Discussion
Omelei
3 years agoFrequent Visitor
LOOKUP value in table from expression
Hi guys,
I am new to PowerBI. Hope you can help.
I created the following table:
| Productconfig id | Product id | Quantity | Opportunity id | Previous Opportunity id (related from other table) | Quantity of product in previous opportunity (this is the column I'd like to create) |
| abcd | aa | 100 | xx | ||
| defg | bb | 100 | xx | ||
| hijk | cc | 200 | xx | ||
| lmno | aa | 100 | yy | xx | 100 |
| pqrs | aa | 150 | zz | yy | 100 |
| tuvw | bb | 400 | zz | yy |
Now I need to add another column with the quantity of the product from the previous opportunity.
I already took the following steps:
- Created column with concatenate of Opportunity ID & Product ID
- Created column with concatenate of Previous Opportunity ID & Product ID
- Used LOOKUPVALUE to lookup quantity of product in previous opportunity
However, LOOKUPVALUE function does not work with expressions.
Any suggestions?
Omelei I would try this:
Column in Table = VAR __PreviousOpp = RELATED('Other Table'[Opportunity id]) VAR __Product = 'Table'[Product id] VAR __Result = MAXX(FILTER('Table',[Product id] = __Product && [Opportunity id] = __PreviousOpp),[Quantity]) RETURN __Result
1 Reply
- Greg_DecklerCommunity Champion
Omelei I would try this:
Column in Table = VAR __PreviousOpp = RELATED('Other Table'[Opportunity id]) VAR __Product = 'Table'[Product id] VAR __Result = MAXX(FILTER('Table',[Product id] = __Product && [Opportunity id] = __PreviousOpp),[Quantity]) RETURN __Result