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
pasno
Helper II
Helper II

Add column to a matrix with % of increase vs previous week

Hello guys,

 

I'm working with a matrix, and I conted the number of whipment splitted by Area (rows) and year-month (columns).

I'd like to add one more column, but I fond some issues when I try to create the new measure.

 

My idea is to create a column that shows the % of variation in comparison with the last n months (let's say 2 month).

So, for example, the measure for March for the 2° row will make this calculation:

Average(13:16) [average of 2° row monhts January and February]

/

24 [value of 2° row for March]

 

Do you have any idea to help me?

 

Thank you very much!!

 

Num ship.PNG

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

Hi @pasno ,

 

1.Create a calendar table.

Calendar =
ADDCOLUMNS (
   CALENDAR ( MIN ( 'Table'[Date] ), MAX ( 'Table'[Date] ) ),
    "YearMonth",
        YEAR ( [Date] ) & "-"
            & MONTH ( [Date] )
)

1.png2.png

 

2.Create a What-if parameter and put it into a slicer.

3.png4.png

 

3.Create this measure.

Percentage = 
DIVIDE (
    DIVIDE (
        CALCULATE (
            SUM ( 'Table'[Value] ),
            DATESINPERIOD ( 'Calendar'[Date], LASTDATE ( 'Table'[Date] ), -3, MONTH )
        )
            - SUM ( 'Table'[Value] ),
        [Parameter Value]
    ),
    SUM ( 'Table'[Value] )
)

5.png

 

You can check more details from here.

 

 

 

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @pasno ,

 

1.Create a calendar table.

Calendar =
ADDCOLUMNS (
   CALENDAR ( MIN ( 'Table'[Date] ), MAX ( 'Table'[Date] ) ),
    "YearMonth",
        YEAR ( [Date] ) & "-"
            & MONTH ( [Date] )
)

1.png2.png

 

2.Create a What-if parameter and put it into a slicer.

3.png4.png

 

3.Create this measure.

Percentage = 
DIVIDE (
    DIVIDE (
        CALCULATE (
            SUM ( 'Table'[Value] ),
            DATESINPERIOD ( 'Calendar'[Date], LASTDATE ( 'Table'[Date] ), -3, MONTH )
        )
            - SUM ( 'Table'[Value] ),
        [Parameter Value]
    ),
    SUM ( 'Table'[Value] )
)

5.png

 

You can check more details from here.

 

 

 

Best Regards,

Stephen Tao

 

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.