Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
yuyu18
Regular Visitor

Compare Value in Table and get Higher value

Hi, for example I have table name: Stock with 2 columns: Product and Price.
And I have 2 search bar: one I entered A, another will be B.
The result I want it to show is the name of product that have higher Price and in this situation will be B

But I dont know how to do. Please help me

ProductPrice
A2000
B3000
C2500
E3500
F4000
5 REPLIES 5
yuyu18
Regular Visitor

😭

Anonymous
Not applicable

Hi, @yuyu18 

 

What is the search bar in PowerBI that you are describing? As per your description, Slicer suits your needs as well, you can try @talespin approach.

 

Best Regards,
Yang
Community Support Team

 

yuyu18
Regular Visitor

😢please help meee

talespin
Solution Sage
Solution Sage

I dont know of search bar, but you can do it with check box. See if this helps.

 

created two identical tables(no relation). Then created two measures, one for Product and one for Price. Also two slicers each showing Product from two tables(Make sure to enable single selection for slicer).

 

talespin_0-1705936003992.png

MaxPriceProduct =
VAR _firstProduct = SELECTEDVALUE(Stock[Product])
VAR _secondProduct = SELECTEDVALUE(Stock2[Product])
VAR _firstProductPrice = CALCULATE(SUM(Stock[Price]), Stock[Product] = _firstProduct)
VAR _secondProductPrice = CALCULATE(SUM(Stock2[Price]), Stock2[Product] = _secondProduct)

return if( _firstProductPrice > _secondProductPrice, _firstProduct, _secondProduct)
---------------------------------------------------------------------------------------------------------------------
PriceProduct =
VAR _firstProduct = SELECTEDVALUE(Stock[Product])
VAR _secondProduct = SELECTEDVALUE(Stock2[Product])
VAR _firstProductPrice = CALCULATE(SUM(Stock[Price]), Stock[Product] = _firstProduct)
VAR _secondProductPrice = CALCULATE(SUM(Stock2[Price]), Stock2[Product] = _secondProduct)

return if( _firstProductPrice > _secondProductPrice, _firstProductPrice, _secondProductPrice)

 

Thank you but I want to take the value from the search bar 😭

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.