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
webportal
Impactful Individual
Impactful Individual

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.

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @webportal 

try MAXX

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

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

5 REPLIES 5
harshnathani
Community Champion
Community Champion

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) 

@harshnathani 

 

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
Community Champion
Community Champion

Hi @webportal 

try MAXX

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

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
webportal
Impactful Individual
Impactful Individual

OK, that one works!

But, why don't the ohters?
MAX, VALUES, LOOKUPVALUE?
webportal
Impactful Individual
Impactful Individual

DISTINCT also works, btw.

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.