cancel
Showing results for
Did you mean:
Highlighted
Regular Visitor

## 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

Accepted Solutions
Highlighted ## Re: Calculating Growth in a Matrix (adding a column)

Hi,

Step 1: Click on Enter data under Modeling tab and enter the following data: 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. You can sort the Category column by creating index column and sort Category column based on index column.

Regards,
Vinay Dandwani
Highlighted ## Re: Calculating Growth in a Matrix (adding a column)

Hi,

Step 1: Click on Enter data under Modeling tab and enter the following data: 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. You can sort the Category column by creating index column and sort Category column based on index column.

Regards,
Vinay Dandwani

Announcements #### June 2020 Community Highlights

Featured community members, changes to the Community, and more! Read up on recent Power BI community news. #### Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start. #### Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications #### Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021 Top Solution Authors
Top Kudoed Authors
Users online (2,454)