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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
iggyvic
Frequent Visitor

Price comparison over purchase orders

Hi,

 

I have this set of data:

Screenshot 2018-12-13 at 13.03.11.png

That represents each item order row placed for purchase. I'd like to measure how the price has changed since the last order placed. E.g. SKU 12345 has been purchased three times: on IK11111, IK22222, and IK33333. Price increased from IK11111 to IK22222 by $0,9 but remained the same from IK22222 to IK33333. To facilitate, the order numbers are auto-generated which means a higher order number equals a later order.

 

I'd like to summarize all the price increases per/SKU. Furthermore, this table is keyed by means of "po-number" to a table containing dates and another one containing purchasers and I'd like to measure these summarized price increases per merchandiser and say year, quarter and month. 

 

Any ideas on how to structure the price difference column?

 

Best regards,

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @iggyvic,

 

I'm not so sure what format of date you used in related table, can you please explain more about this?


For calculate difference between nearest id grouped by sku, you can refer to following measure formula.

Measure =
VAR currPrice =
    MAX ( Table[Price] )
VAR currID =
    MAX ( Table[Id] )
VAR prevID =
    CALCULATE (
        MAX ( Table[Id] ),
        FILTER ( ALLSELECTED ( Table ), [Id] < currID ),
        VALUES ( Table[sku] )
    )
VAR prevPrice =
    CALCULATE (
        MIN ( Table[Price] ),
        FILTER ( ALLSELECTED ( Table ), [Id] = prevID )
    )
RETURN
    currPrice - prevPrice

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @iggyvic,

 

I'm not so sure what format of date you used in related table, can you please explain more about this?


For calculate difference between nearest id grouped by sku, you can refer to following measure formula.

Measure =
VAR currPrice =
    MAX ( Table[Price] )
VAR currID =
    MAX ( Table[Id] )
VAR prevID =
    CALCULATE (
        MAX ( Table[Id] ),
        FILTER ( ALLSELECTED ( Table ), [Id] < currID ),
        VALUES ( Table[sku] )
    )
VAR prevPrice =
    CALCULATE (
        MIN ( Table[Price] ),
        FILTER ( ALLSELECTED ( Table ), [Id] = prevID )
    )
RETURN
    currPrice - prevPrice

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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