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
VANI_YN_80
Regular Visitor

HELP IN CALCULATED COLUMN

Hi All,

 

I am a new user of Power BI and stuck in between to get this data. 

 

I have a data with Current year and previous year where i have a material which is purchased with different vendors ( multiple vendors with multiple purchases). I have to find the Average of each material and compare it with the previous year and to multiply with current year Quantity to get the PPC (purchase price calcuation) PPC formula is APP (average purchase Price) FY - APP PY * FY Quantity.

 

Can anyone help with me urgently with this calculation ?

 

Thanks in advance. 

 

Regards

Vani Y N

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

Hi @VANI_YN_80 ,

 

According to my understanding, you want to calculate value based on each material using this calculation :

(average price of this year  - average price of last year) * total quantity of this year

 

If so, I have built some data for test. Please check:

Material-Price.PNG

You could use the following formula to create a column:

PPC Column = 
VAR _appFY =
    CALCULATE (
        AVERAGE ( 'Table'[Price] ),
        ALLEXCEPT ( 'Table', 'Table'[Material] ),
        YEAR ( 'Table'[Date] ) = YEAR ( TODAY () )
    )
VAR _QuaFY =
    CALCULATE (
        SUM ( 'Table'[Quantity] ),
        ALLEXCEPT ( 'Table', 'Table'[Material] ),
        YEAR ( 'Table'[Date] ) = YEAR ( TODAY () )
    )
VAR _appPY =
    CALCULATE (
        AVERAGE ( 'Table'[Price] ),
        ALLEXCEPT ( 'Table', 'Table'[Material] ),
        YEAR ( 'Table'[Date] )
            = YEAR ( TODAY () ) - 1
    )
RETURN
    ( _appFY - _appPY ) * _QuaFY

The final output is shown below:

PPC.PNG

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-eqin-msft
Community Support
Community Support

Hi @VANI_YN_80 ,

 

According to my understanding, you want to calculate value based on each material using this calculation :

(average price of this year  - average price of last year) * total quantity of this year

 

If so, I have built some data for test. Please check:

Material-Price.PNG

You could use the following formula to create a column:

PPC Column = 
VAR _appFY =
    CALCULATE (
        AVERAGE ( 'Table'[Price] ),
        ALLEXCEPT ( 'Table', 'Table'[Material] ),
        YEAR ( 'Table'[Date] ) = YEAR ( TODAY () )
    )
VAR _QuaFY =
    CALCULATE (
        SUM ( 'Table'[Quantity] ),
        ALLEXCEPT ( 'Table', 'Table'[Material] ),
        YEAR ( 'Table'[Date] ) = YEAR ( TODAY () )
    )
VAR _appPY =
    CALCULATE (
        AVERAGE ( 'Table'[Price] ),
        ALLEXCEPT ( 'Table', 'Table'[Material] ),
        YEAR ( 'Table'[Date] )
            = YEAR ( TODAY () ) - 1
    )
RETURN
    ( _appFY - _appPY ) * _QuaFY

The final output is shown below:

PPC.PNG

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the 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.

Top Solution Authors
Top Kudoed Authors