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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Frequent Visitor

Dynamic Categorization of data based on measures

Hello All,


I'm trying to determine the cheapest price paid for each item and then based on certain criteria bucket the potential savings into different categories.  I've been able to get most of everything I need, however I can only get the categorization to work at the lowest level and not when the data is aggregated.  I know I'm missing something very basic but I can't for the life of me figure it out.  Any help would be immensley appreciated.  


I put together a sanitized and simplistic example of the actual dataset.  


We begin with this basic structure



I use a measure to determine the lowest price for each item - @MFelix was awesome enough to help with




Then this measure determines how much we would have theoretically saved had we purchased at the lowest price

Unit Price Opportunity =
var UP = [Unit Price Best]
CALCULATE(SUM(Sheet1[Total])-[Unit Price Best Total])

This measure determines who the lowest priced supplier is for each item

Unit Price Best Supplier =
var best = [Unit Price Best]

All of this is working well, however if there's a better way to do any of that feel free to let me know.  The problem comes in with the final measure which attempts to bucket the potential opportunity.  If the item is cheaper from a different supplier it would say other vendor and if we're simply getting the item cheaper from the same vendor it would say Price Parity


Unit Price Best Opportunity Type 2 =
var best = [Unit Price Best]
var bs = [Unit Price Best Supplier]


SELECTEDVALUE(Sheet1[Unit Price])=[Unit Price Best],"",
SELECTEDVALUE(Sheet1[SUPPLIER_NAME])=bs&&SELECTEDVALUE(Sheet1[Unit Price])>best,"Price Parity",
SELECTEDVALUE(Sheet1[SUPPLIER_NAME])<>bs&&SELECTEDVALUE(Sheet1[Unit Price])>best,"Other Vendor",



When I include the unit price field in the table it works with no issue, however when I roll it up it doesn't.  




I need to be able to show it at the level of the middle table as well as simply have a chart that shows the total opportunity by type.  


I have a PBIX setup to try and help anyone that would like to help out and will try to determine how to attach it.  

Frequent Visitor

Thank you both so much, hopefully this link should work.


I added a table entitled Expected, which simply summarizes the main table and adds the measures stated above.  Then added an expected sheet for how the expected result should work.  This would of course work for my real dataset, however based on what filters the user selects the lowest unit price may change, thus using a static intermediary table wouldn't work.  I've tried that table as a variable within the measures but just couldn't get it to work.  


One last note, the first table on the expected sheet will be a graph on the final report, but as i'm sure you know using measures for your axis labels is a whole other item.  I have that piece working fine in the final solution so for simplicity I kept this pbix to the root issue.

I have still not understood your requirement.  Someone else will help you.

Ashish Mathur
Super User
Super User

Hi @soshaughnessy7 


Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Miguel Félix

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

Proud to be a Super User!

Check out my blog: Power BI em Português

Super User
Super User


I'd like to try.  Share your PBI file,  In that file, please show the expected result very clearly with a proper explanation.

Ashish Mathur

Helpful resources

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.