Forum Discussion

webportal's avatar
webportal
Icon for Impactful Individual rankImpactful Individual
6 years ago
Solved

Get value from a table where condition meets

 
My CalculatedTable contains 3 rows and 3 columns, like:
Index | Name | Value
1     | ABC  | 123
2     | DEF  | 456
3     | GHI  | 789

I want to extract the Name out of Index = 2. So basic, and yet so complicated.

This is my code:

Measure := 
 VAR CalculatedTable = ....

 RETURN
 CALCULATE(MAX('CalculatedTable'[Name]), 
   FILTER('CalculatedTable', 'CalculatedTable'[Index] = 2))

This doesn't work, and also, instead of MAX, also tried with VALUES and LOOKUPVALUE, but none works.

  • az38's avatar
    az38
    6 years ago

    Hi webportal 

    try MAXX

    return 
    calculate(maxx(FILTER(CalculatedTable, [Index] = 2), [Name]))

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi webportal ,

     

    CALCULATE(MAX('CalculatedTable'[Name]),'Index' = 2)

    Regards,
    Harsh Nathani
    Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button) 

    • webportal's avatar
      webportal
      Icon for Impactful Individual rankImpactful Individual

      Anonymous 

       

      Thanks, but I get the error:

       

      It's not possible to use the table variable 'CalculatedTable' in the actual context because it is expected a base table.

      • az38's avatar
        az38
        Icon for Community Champion rankCommunity Champion

        Hi webportal 

        try MAXX

        return 
        calculate(maxx(FILTER(CalculatedTable, [Index] = 2), [Name]))