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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
hainguyen28
Regular Visitor

Add a row header for matrix

Currently, I have this matrix in power BI that shows different cost elements of different countries in different dates. There are many different cost elements that the use can filter through.

hainguyen28_0-1738301832505.png

 

Right now, I am told to add a new column for the "Depreciation" cost element across different countries of the latest date as a fixed column. Essentially, this column will serve as a benchmark for other cost elements, and won't change no matter what cost element is chosen. 

 

For example, if the user select "CAPEX" cost element, the matrix will look something like this:
- 1st column: Countries

- 2nd colunn: "Depreciation" cost of Jan 7th, 2020

- 3rd-9th column: "CAPEX" cost of Jan 1st - Jan 7th, 2020

 

Does anyone know how to do this?

4 REPLIES 4
MFelix
Super User
Super User

Hi @hainguyen28 ,

 

For this you can use a calculation group that will get that value that you need.

 

Create a calculation group with two calculation items:

Depreciation =
VAR _MaxDate = MAXX(ALLSELECTED(Calendar[Date]))
Return

 IF(ISINSCOPE(dCalendario[Data]), BLANK(), 
CALCULATE([Depreciation], Calendar[Date] = _MaxDate))

Other Elements = SELECTEDMEASURE()

Now add the measure that you want to have on the other columns and apply the calculation item to the columns of your matrix:

MFelix_0-1738343257036.png

 

The matrix must only have the measure that you want to have detail by day do not add any other metric the calculation group will return the correct measure for depreciation.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix,

 

Thanks for replying. I am trying to replicate your code; however, I don't understand what dCalendario[Data] means in your code.

 

This is how my data table looks like:

hainguyen28_0-1738532591323.png

"Depreciation" and "CAPEX" are all under "Cost Element".

What would be equivalence of your code using my table?

 

Hi @hainguyen28 ,

 

The dCalendario[Data] is the date column that you are using on your visual, apologies for not translating it.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix , thanks for your reply. I am trying to replicate your code, however, I don't understand what dCalendario[Data] is in your code. This is how my table looks like:

hainguyen28_0-1738530648802.png

What would be the equivalent of dCalendario[Data] in your code?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.