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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Calculating Growth in a Matrix (adding a column)

Hi Hoping someone can help. I have some source data with thousands of records of events data including two columns which signify event segment and period. I've summarized these in a matrix and wish to add a column that shows the %age growth between the two periods.

 

I've provided an example set up of the table below (dummy data) - the ask here is to calculate the % growth between the two periods for each segment (period is just one column with two possible values: 'period 1 & period 2':

 

Segment          |         Period 1          |          Period 2            |          % Growth?

A                          |          110                   |           120

B                           |          100                  |            100

C                          |          120                   |            130

D                          |           90                    |              120

E                          |            100                 |             110

 

Thank You

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

Please follow the steps below:

Step 1: Click on Enter data under Modeling tab and enter the following data:

 

create table.png

 

 

Step 2:

Create the following measure:

Growth =
VAR period1 =
CALCULATE(
SUM('Table'[Period Value]),
FILTER(
'Table',
'Table'[Period] = "Period 1"
)
)

VAR period2 =
CALCULATE(
SUM('Table'[Period Value]),
FILTER(
'Table',
'Table'[Period] = "Period 2"
)
)

VAR division =
CALCULATE(
DIVIDE(
period2 - period1,
period2,
0
)
)

RETURN
IF(
SELECTEDVALUE(Category[Category]) = "Period 1",
SUMX(FILTER('Table', 'Table'[Period] = "Period 1"), 'Table'[Period Value]),
IF(
SELECTEDVALUE(Category[Category]) = "Period 2",
SUMX(FILTER('Table', 'Table'[Period] = "Period 2"), 'Table'[Period Value]),
IF(
SELECTEDVALUE(Category[Category]) = "Growth",
FORMAT(division, "Percent")
)
)
)
 
Step 3:
In matrix visual, drag Category column from Category table under Columns.
 
matrix visual.png
 
You can sort the Category column by creating index column and sort Category column based on index column.
 
Regards,
Vinay Dandwani

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi,

Please follow the steps below:

Step 1: Click on Enter data under Modeling tab and enter the following data:

 

create table.png

 

 

Step 2:

Create the following measure:

Growth =
VAR period1 =
CALCULATE(
SUM('Table'[Period Value]),
FILTER(
'Table',
'Table'[Period] = "Period 1"
)
)

VAR period2 =
CALCULATE(
SUM('Table'[Period Value]),
FILTER(
'Table',
'Table'[Period] = "Period 2"
)
)

VAR division =
CALCULATE(
DIVIDE(
period2 - period1,
period2,
0
)
)

RETURN
IF(
SELECTEDVALUE(Category[Category]) = "Period 1",
SUMX(FILTER('Table', 'Table'[Period] = "Period 1"), 'Table'[Period Value]),
IF(
SELECTEDVALUE(Category[Category]) = "Period 2",
SUMX(FILTER('Table', 'Table'[Period] = "Period 2"), 'Table'[Period Value]),
IF(
SELECTEDVALUE(Category[Category]) = "Growth",
FORMAT(division, "Percent")
)
)
)
 
Step 3:
In matrix visual, drag Category column from Category table under Columns.
 
matrix visual.png
 
You can sort the Category column by creating index column and sort Category column based on index column.
 
Regards,
Vinay Dandwani

Hi Vinay,

 

If you have 36 periods, what way will you explore to show dynamic MTD and YTD vs pcp as last two colums?

 

Thank you!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.