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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
swartor
New Member

Sum 2 columns in matrix table

Hi is it posible to sum 2 columns from 14 in matrix view as a extra column in the same view.

swartor_1-1648132289717.png

 

This is list of person nad summary work time for certain topics i need in this matrix extra sum of time spend on 2 topix together.

 

I want to add 1 extra column to this matrix with number 15 and the valu for this column will be sum of col 3 and 4.

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

It's possible but not simple. The problem is that you currently have one measure (llosc_dni) computed against two dimensions (Nazwisko_imie and Title) but you want to add a new measure that acts as an extra Title dimension value. Measures get evaluated in the context generated by the dimensions you put on the rows and columns, which is why if you add a new measure, it shows up under each number 1-14.

 

To do what you want, there are two approaches I can think of:

  1. Remove the Title dimension from columns and create separate measures for each number you want to show.
  2. Alter the existing table or create a new table to use as your header that includes 15 and define a measure that switches calculations accordingly.

Here's an example of the second approach for a similar but more complex situation:

https://stackoverflow.com/questions/52632713/custom-aggregate-column-in-power-bi-matrix

View solution in original post

9 REPLIES 9
AlexisOlson
Super User
Super User

It's possible but not simple. The problem is that you currently have one measure (llosc_dni) computed against two dimensions (Nazwisko_imie and Title) but you want to add a new measure that acts as an extra Title dimension value. Measures get evaluated in the context generated by the dimensions you put on the rows and columns, which is why if you add a new measure, it shows up under each number 1-14.

 

To do what you want, there are two approaches I can think of:

  1. Remove the Title dimension from columns and create separate measures for each number you want to show.
  2. Alter the existing table or create a new table to use as your header that includes 15 and define a measure that switches calculations accordingly.

Here's an example of the second approach for a similar but more complex situation:

https://stackoverflow.com/questions/52632713/custom-aggregate-column-in-power-bi-matrix

Thank you very much. You saved me.

How did you manage to get it right? 

Tahreem24
Super User
Super User

@swartor  Kindly share the Column name you want to add? Or simply share the screen shot like below:

Capture.JPG

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

swartor_0-1648132921288.png

 

@swartor  Try this:

 = Calculate(SUM(Ilosc_dni),Title IN {3,4})

OR

= CALCULATE(SUM(Ilosc_dni), Title=3 || Title =4)

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Sry for this question but i dont know where to add this.

Do i hav to create a new measure and insert it to columns or hav to make some code editing but dont know where.

@swartor Just create a new Measure with that given code. 

MEASURE= CALCULATE(SUM(Ilosc_dni), Title=3 || Title =4)

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Ok i create it like this 

MEASURE = CALCULATE(SUM('test importu'[Ilosc_dni]), 'RCP-Statusy'[Title]=3 || 'RCP-Statusy'[Title] =4)
 
But i cant add it to Columns and when i add it to Values i get view like this 
swartor_0-1648134720853.png

 

Do i hav to make separate measure for every column i want and then add one by one to Values?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.