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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
jswwood
Regular Visitor

Value range lookup - M Query

Hi

 

Im trying to determine a price bracket by using a looku table which has a price from column and a price to e.g.

 

Price Bracket     Price From   Price To

100K - 125K      100000        125000

 

I have tried merging the lookup table as a cartesian join to my trans table then creating a flag column to filter by eg "If Price >= [Price From] and Price <= [Price To] then 1 else 0 (Filter = 1). It works but as anticipated runs like a 'dog', taking hours to process. Is there a slicker way please rather than resorting to {if price >= 100,000 and price <= 125000 then "100k-125k" elseif price >= 125001 and .... etc etc

 

Thank you in anticipation!

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

This is much easier to do with DAX in a column or a measure.  Please see this post for an example.

 

https://forum.enterprisedna.co/t/dynamic-bin-segmentation/1250/2

 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

This is much easier to do with DAX in a column or a measure.  Please see this post for an example.

 

https://forum.enterprisedna.co/t/dynamic-bin-segmentation/1250/2

 

If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


 Hi Pat

 

Thanks for the reply. Ive marked as solution but I am looking for an M Query solution with a view to Users not having to get involved in more complex Functions. I will carry out some performance tests as it may be the best route.

 

Thank you again.

 

Kind Regards

 

John

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.