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 August 31st. Request your voucher.

Reply
JACK__
Frequent Visitor

Create a Column in Matrix which does (this week price) - (last week price) for multiple weeks

So no idea where to start with this soltuion.

What matrix I am after:

Week11223344
ItemPriceChangePrice ChangePriceChangePriceChange
123456_5 50615-1
456789_4 3-13041

 

The input data is from excel with columns for Item, Week, Price. I am wanting to calculate the change in price from one week to the next within PowerBI. Is it possible to create a single column which will accommodate this when added to the matrix, for example:
Week 2 Change = (Week 2 Price) - (Week 1 Price)
Week 3 Change = (Week 3 Price) - (Week 2 Price)
?

Appreciate the help, hopefully someone has a solution! 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JACK__ ,

 

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

(1) This is my test data. 

vtangjiemsft_0-1707188018986.png

(2) We can create a calculated column.

Change = 
IF (
    [Week]
        = CALCULATE (
            MIN ( 'Table'[Week] ),
            FILTER ( ALL ( 'Table' ), 'Table'[Item] = EARLIER ( 'Table'[Item] ) )
        ),
    BLANK (),
    [Price]
        - CALCULATE (
            SUM ( 'Table'[Price] ),
            FILTER (
                'Table',
                'Table'[Item] = EARLIER ( 'Table'[Item] )
                    && 'Table'[Week]
                        = EARLIER ( 'Table'[Week] ) - 1
            )
        )
)

(3) Then the result is as follows.

vtangjiemsft_1-1707188075645.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 @JACK__ ,

 

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

(1) This is my test data. 

vtangjiemsft_0-1707188018986.png

(2) We can create a calculated column.

Change = 
IF (
    [Week]
        = CALCULATE (
            MIN ( 'Table'[Week] ),
            FILTER ( ALL ( 'Table' ), 'Table'[Item] = EARLIER ( 'Table'[Item] ) )
        ),
    BLANK (),
    [Price]
        - CALCULATE (
            SUM ( 'Table'[Price] ),
            FILTER (
                'Table',
                'Table'[Item] = EARLIER ( 'Table'[Item] )
                    && 'Table'[Week]
                        = EARLIER ( 'Table'[Week] ) - 1
            )
        )
)

(3) Then the result is as follows.

vtangjiemsft_1-1707188075645.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, this works great

lbendlin
Super User
Super User

yes, that sounds like it is possible. Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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