Forum Discussion
Product Price Variance
- 1 year ago
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.
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?
- Anonymous1 year agoNot applicable
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:
Best Regards,
ZhuIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- nroeder1 year agoFrequent Visitor
That's close but how would you make it Item specific? So only show the variance per item not for all items displayed?
- Anonymous1 year agoNot applicable
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.
Best Regards,
Zhu