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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

extract column heading based on condition from another table

I have two tables. One is Product table has two columns., Product and Price.

Product table

ProductPrice
A6.5
A4.2
B75
C28
B43
C62
A2.2

The another table has Price range for each product (categorised by Range1, Range2, Rabge3 and Range4)

PriceRangeTable

ProductRange1Range2Range3Range4
A<=3>3 - <=5>5 - <=7>7
B<=15>15 - <=25>25 - <=50>50
C>75<75 - >=50<50 - >=25<25

I want a Calculated Column (Range) in Product table based on the price that fits in the range for specific product

Output Table could be

ProductPriceRange
A6.5Range3
A4.2Range2
B75Range4
C28Range3
B43Range3
C62Range2
A2.2Range1
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

I am not sure how your whole data model looks like, but in my opinion, it is good to have the PriceRange-Table structure like below. It is easy in Power Query to change like below.

Then calculated column can be created in an efficient way.

 

Picture1.png

 

https://www.dropbox.com/s/ycs1w4547kkhhid/eswar.pbix?dl=0 

 

Ranges CC =
VAR prices = 'Product'[Price]
VAR products = 'Product'[Product]
RETURN
CALCULATE (
SELECTEDVALUE ( PriceRange[Range] ),
FILTER (
PriceRange,
PriceRange[Product] = products
&& prices >= PriceRange[Min]
&& prices < PriceRange[Max]
)
)
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
negi007
Community Champion
Community Champion

@Anonymous You may need to have value in numberic form in your price range table, else it is difficult to perform calculation. There is already a solution for similar problem, please refer to below link, it will take you in the right direction.

 

https://community.powerbi.com/t5/Desktop/Lookup-Price-Range-for-Style/m-p/322514#M143719

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

I am not sure how your whole data model looks like, but in my opinion, it is good to have the PriceRange-Table structure like below. It is easy in Power Query to change like below.

Then calculated column can be created in an efficient way.

 

Picture1.png

 

https://www.dropbox.com/s/ycs1w4547kkhhid/eswar.pbix?dl=0 

 

Ranges CC =
VAR prices = 'Product'[Price]
VAR products = 'Product'[Product]
RETURN
CALCULATE (
SELECTEDVALUE ( PriceRange[Range] ),
FILTER (
PriceRange,
PriceRange[Product] = products
&& prices >= PriceRange[Min]
&& prices < PriceRange[Max]
)
)
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Thank you for making the concept (having Min and MAx column for grades) clear.

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors