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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
nroeder
Frequent Visitor

Product Price Variance

I currently have a table with Item#, Invoice#, Price, and Qty. 

 

I want to be able to find price variances of products over mulitple invoices. 

Ex. Item# AB-101 cost $4 on Invoice#101

 Item# AB-101 cost $4.30 on Invoice#204

 

Also i'm using Direct Query.

1 ACCEPTED SOLUTION
Shravan133
Solution Sage
Solution Sage

Create a measure for min price :

Min Price =
CALCULATE(
MIN('YourTable'[Price]),
ALLEXCEPT('YourTable', 'YourTable'[Item#])
)

 

2. same for max price:

Max Price =
CALCULATE(
MAX('YourTable'[Price]),
ALLEXCEPT('YourTable', 'YourTable'[Item#])
)

 

3. Variance:

Price Variance = [Max Price] - [Min Price]

This measure will reflect the difference between the highest and lowest prices across all invoices for each item.

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Drag Product to the Table visual.  Write these measures

Min price = min(Data[Price])

Max price = max(Data[Price])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Shravan133
Solution Sage
Solution Sage

Create a measure for min price :

Min Price =
CALCULATE(
MIN('YourTable'[Price]),
ALLEXCEPT('YourTable', 'YourTable'[Item#])
)

 

2. same for max price:

Max Price =
CALCULATE(
MAX('YourTable'[Price]),
ALLEXCEPT('YourTable', 'YourTable'[Item#])
)

 

3. Variance:

Price Variance = [Max Price] - [Min Price]

This measure will reflect the difference between the highest and lowest prices across all invoices for each item.

Worked perfectly! Thanks. Is there an easy way to apply the current active filter to the result set. Ex. Limit max and min of an item to the active invoices shown on the page?

Thanks for the replies from Ashish_Mathur and Shravan133.

 

Hi @nroeder ,

 

Please try the following DAX formula:

Max = CALCULATE(MAX('Table'[Price]),ALLSELECTED('Table'))
Min = CALCULATE(MIN('Table'[Price]),ALLSELECTED('Table'))

 

Result:

vlinhuizhmsft_0-1731551463979.png

Best Regards,
Zhu

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

That's close but how would you make it Item specific? So only show the variance per item not for all items displayed?

Hi @nroeder ,

 

If you want to show the variance per item item, I think you just need to follow Shravan133's  answer and then filter use Invoice# field.

vlinhuizhmsft_0-1731640665029.png

Best Regards,
Zhu

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

October NL Carousel

Fabric Community Update - October 2024

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