Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

add column with value based on filter

I have two tables

OrderID Date
113-okt
214-okt

 

OrderID OrderLine Product Price
11A5
12B4
21A5
22B4
23C2

 

I want to add a column in Table 1 with the name of the product with the highest price. So the table looks like this:

OrderID Date  Product
113-oktA
214-oktA

Which formula should I use?

  • Anonymous , 

     

    Use something like this with relatioship.

     

    Column = CALCULATE(DISTINCT('Table (4)'[Product ]),FILTER('Table (4)','Table (4)'[Price]=MAX('Table (4)'[Price])))
     
    You can use the above DAX on both Calculated column or Measure. 
     
    Regards, 
    Manikumar
     
    If you think tjis is helpful, please Accept as Solution and leave a like.

2 Replies

  • Anonymous , 

     

    Use something like this with relatioship.

     

    Column = CALCULATE(DISTINCT('Table (4)'[Product ]),FILTER('Table (4)','Table (4)'[Price]=MAX('Table (4)'[Price])))
     
    You can use the above DAX on both Calculated column or Measure. 
     
    Regards, 
    Manikumar
     
    If you think tjis is helpful, please Accept as Solution and leave a like.