Forum Discussion

Ben2605's avatar
Ben2605
New Member
8 years ago
Solved

Price variance measure

Hello,

 

I'm relatively new to PowerBI and hoping someone can help me with what seems a simple problem - it would take 2 seconds in excel but I'm struggling with DAX to get the 'right' answer in PowerBI.

 

I have a table called 'Supplier' containing a number of suppliers and unit prices. I'd like to set up a table showing the price difference between supplier 'c' and each of the suppliers.

 

NamePriceVariance to C
a £1-£2
b £2-£1
c £3 £-  
d £4 £1
e £5 £2
f £6 £3

 

I've written the following measure..

 

SupplierVar = SUM(supplier[price])-CALCULATE(SUM(supplier[price]),FILTER(supplier,supplier[name]="c"))

 

The measure above does not give me the desired result. 

 

Any pointers would be appreciated.

 

Thanks

  • Hello,

     

    Try this:

     

    SupplierVar = SUM(supplier[price])-CALCULATE(SUM(supplier[price]),supplier[name]="c")

     

    just removed Filter from your function :)

2 Replies

  • Hello,

     

    Try this:

     

    SupplierVar = SUM(supplier[price])-CALCULATE(SUM(supplier[price]),supplier[name]="c")

     

    just removed Filter from your function :)

    • Ben2605's avatar
      Ben2605
      New Member

      how frustrating - such a simple solution!

       

      Thanks Washivale for the quick response.