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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
L70F
Helper II
Helper II

Dynamic comparison of different values

Hi, 

I hope someone can help me to get it working in Power Query.

 

I have two tables of items with old and new prices depended on different quantities.

 

The number of given combination “From Qty”<=>”Price Qty” might vary both for different items in the same table and for the same items in the different tables.

 

I have also one more table with  Annual_DMD and Order_Qty for the same items.

 

Wished result is table with qty and prices closest to Order_qty to evaluate price changes.

 

On each item level should:

  1. value “From Qty_x” compares with value of ORDER_QTY.

    If value “From Qty_x” is the same or closest below “ORDER_QTY”, then this value and “Price qty-x“ are chosen to the result table.

  2. If such value doesn’t exist, chose “From Qty_x” closest above “ORDER_QTY”. This value and “Price qty-x“ goes to the result table.
  3.  Calculate the “Old price volume” = “Price QTY_Old” * ”ANNUAL_DMD” and
    “New price volume” = “Price QTY_New” * ”ANNUAL_DMD”

    Is it possible to show the “Total SUM” of this columns in the upper row?

 4. Culculate the % of price change: “% price”= (“New price volume” - “Old price volume”)/ (“Old price volume”)

 

Thanks a lot and best regards

Exemple to PQ.jpg

1 ACCEPTED SOLUTION

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

This sounds like a good one for @ImkeF...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Dear Imke,

thank you for sharing this tips. It looks like a great solution, but unfortunataly it doesn't help my problem due I have need to go along the row to find the right value. To do transforming to the list is not good idea because the each item has several values and my project can consist of several thousand of items.

BR//Larissa

Hi Imke, it was quite complecated to come to the desired result with your suggestion, but I succed to the end. If there is no other more easy way to solve this I accept it as solution.

BR//Larissa

Let's assume it's 100 000 items and each item has five columns, this doesn't come out to more than 500 000 rows which is nothing in a PBI model so you should be afraid to unpivot the data if that makes working with the data simpler. Because it's a column store the number of rows has little importance, what matters is the cardinality of columns.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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 Solution Authors
Top Kudoed Authors