cancel
Showing results 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.

Helper V

## Calculation Groups - Difference measures

Hi,

I need the layout like below to be in a matrix. I've used a calculation group for current and previous period and this works well because they are using the same fields.

My problem is that Growth has some different calculations to the other two, and as this all needs to be on the same matrix I'm struggling to put it together.

Could somebody please advise if this is possibele?

1 ACCEPTED SOLUTION
Super User

output

link to file :

let me know if this works for you .

If this answers your question  ,  mark it as the solution so can you can help  other people in the community find it easily .

13 REPLIES 13
Super User

sorry but the image is somewhat confusing .( for me maybe ) .

you want to have 2 levels in the columns :
level1 :

growth current period vs previous perd ,

previous period

current period

level2 :

growth %, growth \$

sales , profit

sales , profit

Helper V

Hi @Daniel29195 ,

Currently its coming out below which is correct, but how would I add two more columns onto the growth but not onto the other two (Current Period & Previous Period).

Growth needs to have 4 columns on the matrix and current period and previous need to have two.

Super User

maybe you can do the following :
create a table with the following structure :

level 1                                         level2

growth                                      total sales

growth                                       total margin

growth                                       calculation 3

growth                                       calculation 4

previous period                            total sales

previous period                            total margin

current period                                total sales

current period                              total margin

then in your calculation you can use one measure with switch statement

Helper V

Hi @Daniel29195 ,

Apologies I'm a little confused. When you say table with levels, do this mean with calculation groups?

Thanks again

Liam

Super User

table using enter data  manually .

this way you are creating the structure of your table how you want it to be .

and then you play with the measure and switch to change the calculation behavior base on the column you are in .

Helper V

The best I've managed is to get both measures to display as blank in a matrix by using this in tabular editor

`IF( SELECTEDMEASURENAME() in {"Cost1", "Cost2"}, BLANK(), SELECTEDMEASURE() - CALCULATE(SELECTEDMEASURE(), SAMEPERIODLASTYEAR(DimDate[DateFull])) )`

Helper V

Thanks @Daniel29195 . And this would still come out grouped like below?

Super User

yes sure.

if you can, share some sample data, and i will do it for you .

Helper V

Thank you so much.

I hope that's okay what I've attached. I've used shapes to show what I require on the page

Sample Data.pbix

Super User

output

link to file :

let me know if this works for you .

If this answers your question  ,  mark it as the solution so can you can help  other people in the community find it easily .

Helper V

Thanks @Daniel29195  for your time with this. This works.

With this setup, is it possible to had another column outside of the top heading like below, or even if the top level was blank.

Super User

isnt this what you mean ?
( the ones in blue circles )

Helper V

I'm not sure if it replied to the right reply, but If I put it like in the example below. It would need to be in values to display as a solid column in the matrix but for example a customer having a start date that would need to show for each customer going down, but it wouldnt necessarily be in any of the 3 levels.

Announcements

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

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors