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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
RaMiRo87
Frequent Visitor

Average purchase price from 2023

Hi all,

 

I've been searching the forum for my topic but haven't found anything related to my recent problem.

 

I have a data table named 'Purchase Price'. Here I'm calclulating different KPIs, for example the average of the purchase price for the fiscal year 2023 for every product. For this I'm using the column [Purchase Price (Accounting) Inventory], the date column [CreatedOn] as well as the column for the product or item nr. [ItemId]. I'll show you how it looks like and give you a simplified example:

 

ItemIdCreatedOnPurchase Price (Accounting) InventoryAverage Purchase Price (Accounting) 2023
123412.05.202270 
123401.12.20235030
123409.10.20231030

 

The last two of the three records should be considered for calclulating the average because they are booked in 2023.

 

The column [Average Purchase Price (Accounting) 2023] is my desired solution but I would be glad about any working solution to be honest. 

 

Please let me know if you need any other information or detail of the data. 

 

Thank you in advance! Ramirez

2 ACCEPTED SOLUTIONS
bhanu_gautam
Super User
Super User

@RaMiRo87 , You can create a measure for this using

 

Average Purchase Price (Accounting) 2023 =
CALCULATE(
AVERAGE('Purchase Price'[Purchase Price (Accounting) Inventory]),
YEAR('Purchase Price'[CreatedOn]) = 2023
)

 

Please accept as solution and give kudos if it helps




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

Anonymous
Not applicable

Hi @RaMiRo87 ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure.

Average Purchase Price (Accounting) 2023 = 
IF(YEAR(MAX('Purchase Price'[CreatedOn]))=2023,CALCULATE(AVERAGE('Purchase Price'[Purchase Price (Accounting) Inventory]),YEAR('Purchase Price'[CreatedOn]) = 2023),BLANK())

(3)Or we can create a calculated column.

_Average Purchase Price (Accounting) 2023 =
IF (
    YEAR ( 'Purchase Price'[CreatedOn] ) = 2023,
    CALCULATE (
        AVERAGE ( 'Purchase Price'[Purchase Price (Accounting) Inventory] ),
        FILTER ( 'Purchase Price', YEAR ( 'Purchase Price'[CreatedOn] ) = 2023 )
    ),
    BLANK ()
)

(4) Then the result is as follows.

vtangjiemsft_0-1708499047193.png

vtangjiemsft_1-1708499069606.png

Best Regards,

Neeko Tang

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

3 REPLIES 3
Anonymous
Not applicable

Hi @RaMiRo87 ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure.

Average Purchase Price (Accounting) 2023 = 
IF(YEAR(MAX('Purchase Price'[CreatedOn]))=2023,CALCULATE(AVERAGE('Purchase Price'[Purchase Price (Accounting) Inventory]),YEAR('Purchase Price'[CreatedOn]) = 2023),BLANK())

(3)Or we can create a calculated column.

_Average Purchase Price (Accounting) 2023 =
IF (
    YEAR ( 'Purchase Price'[CreatedOn] ) = 2023,
    CALCULATE (
        AVERAGE ( 'Purchase Price'[Purchase Price (Accounting) Inventory] ),
        FILTER ( 'Purchase Price', YEAR ( 'Purchase Price'[CreatedOn] ) = 2023 )
    ),
    BLANK ()
)

(4) Then the result is as follows.

vtangjiemsft_0-1708499047193.png

vtangjiemsft_1-1708499069606.png

Best Regards,

Neeko Tang

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

Thank you very much for your well structured solution! Got everything I needed and my own Measure that I've prepared before posting this comes close. 🙂 

 

Thanks and kind regards

bhanu_gautam
Super User
Super User

@RaMiRo87 , You can create a measure for this using

 

Average Purchase Price (Accounting) 2023 =
CALCULATE(
AVERAGE('Purchase Price'[Purchase Price (Accounting) Inventory]),
YEAR('Purchase Price'[CreatedOn]) = 2023
)

 

Please accept as solution and give kudos if it helps




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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