# Adding multiple columns in Matrix columns



## Sandeep3072 (Jul 22, 2019)

Hi All,

I am new to power BI and I have requirement to do in power BI where I need to show the some of key metrics in matrix format.

Here is the my requirement.

Well I am working for the Textile company where in I need to  prepare the reports using Power BI and unfortunately I could not make  it. I use matrix for the showing the differences of reports between 2018  and 2019.


Please check the below screen shot where I need to get the output like mentioned screenshot.






Please note that %Change in the above table is a measure which I had written % change = DIVIDE(CALCULATE(SUM(Table1[<wbr>Reports]),Table1[Year]=2019)-<wbr>CALCULATE(SUM(Table1[Reports])<wbr>,Table1[Year]=2018),
CALCULATE(SUM(Table1[Reports])<wbr>,Table1[Year]=2018))

When I am trying to add the same measure in my matrix the % change showing
for the both 2018 and 2019 years and I need it at the end of matrix.







You may check the my visualization pane to verify the rows and columns.

Is there any work around for the same issue and I've trying itfor a long time and finally seeking for your help.

Thanks for your support.


----------



## Matt Allington (Jul 23, 2019)

It seems your images didn't post on either thread. This makes it difficult for people to help you.  I recommend you see if you can sort that out as there are lots of people willing to help for free - but you have to make it easy for them.  You issue is that you have put year on the columns in your report and also a measure.  This creates 2 levels of data.  The top level is the year and underneath that is the measure.  In your case, the years are 2018 and 2019, and the measure is simply showing the % change for 2019 vs 2018, hence the problem.  Better to write 3 measures.

Total 2018 = CALCULATE(SUM(Table1[Reports])<wbr style="color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">,Table1[Year]=2018)
Total 2019 =CALCULATE(SUM(Table1[Reports])<wbr style="color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">,Table1[Year]=2019)
% change = DIVIDE([Total 2019] -[Total 2018],[Total 2018])

If you add these 3 measures, it will be at a single level and hence it will do what you want.

Better still, write these measures

```
Total This Year = VAR ThisYear = max[COLOR=#000000](T[/COLOR][COLOR=#000000]able1[Year])[/COLOR][COLOR=#000000]
                         RETURN CALCULATE(SUM(Table1[Reports])[/COLOR]<wbr style="color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">[COLOR=#000000],Table1[Year]=ThisYear)
[/COLOR]Total Last Year = VAR LastYear = max[COLOR=#000000](T[/COLOR][COLOR=#000000]able1[Year][/COLOR][COLOR=#000000])-1
                         RETURN CALCULATE(SUM(Table1[Reports])[/COLOR]<wbr style="color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">[COLOR=#000000],Table1[Year]=LastYear)[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]% change = DIVIDE([Total This Year] -[Total Last Year],[Total Last Year)[/COLOR]
```

Add the 3 measures to the matrix and add a slicer from the year column.  When you select the year in the slicer, it will update to show you the selected year and prior year


----------

