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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors