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
schristian
Frequent Visitor

Lookup max value in an appended table

I'm trying to figure out a way to lookup a max value from the BP column to match with a name (Comm ID). When I do lookup value, I just get to notification that there are multiple values which is an issue I anticipated.

 

Ultimately, what I would want is for any row with A5 as the Comm ID to have 3 as a max value while any row with B6 as the Comm ID to have 4 as its Max value.

 

Is there any way to pull this off?

 

 

BPComm IDMax Value

1

A5 
2A5 
3A5 
1B6 
4B6 
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

=CALCULATE(MAX(DATA[BP]),FILTER(DATA,DATA[COMM ID]=EARLIER(DATA[COMM ID])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
v-jayw-msft
Community Support
Community Support

Hi @schristian ,

 

If i understand you correctly, ALLEXCEPT() function might be helpful for you.

You can use the formula below both in Measure and Calculated Column.

Max Value = CALCULATE(MAX('Table'[BP]),ALLEXCEPT('Table','Table'[Comm ID]))

Result would be shown as below.

 1.PNG2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

hi all - thanks for everyones suggestions. I think I should've included that sometimes the BP column is blank. All of the suggestions returned a 0 value. Could the blanks be a cause?

Hi @schristian ,

 

Based on my research, I don't think the blank value could affect the result of my formula.

3.PNG

It would be better to share your pbix or sample data to us if you don't have any Confidential Information. In that case we might help you find out what caused the results return 0 values.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

You are welcome.  Blanks should not be the reason for my formula not working.  See the screenshot below.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur Noticed I made an error elsewhere and your solution worked. Appreciate everyone's help with this!

Anonymous
Not applicable

HI @schristian ,

 

May be you can give a try with this:

 

Max Value =
Var BP= SELECTEDVALUE('Table'[BP])
Var MaxValue=
if(BP<>blank() || BP= BLANK(),
Calculate(Max('Table'[BP]),ALLSELECTED('Table'[BP])))
return
MaxValue
 
My output:
Capture11.PNG
 
-Tejaswi
Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

=CALCULATE(MAX(DATA[BP]),FILTER(DATA,DATA[COMM ID]=EARLIER(DATA[COMM ID])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

HI @schristian ,

You may go thru this solution for the lookup value error.

 

https://community.powerbi.com/t5/Desktop/LOOKUPVALUE-quot-A-table-of-multiple-values-was-supplied-wh...

 

Or you can try this measure for your issue:

 
Max Value = Calculate(Max('Table'[BP]),ALLSELECTED('Table'[BP]))

 

May be this helps.

 

Thanks,

Tejaswi

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.