The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
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?
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:
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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @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:
"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
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @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:
What would be the equivalent of dCalendario[Data] in your code?
User | Count |
---|---|
78 | |
77 | |
37 | |
33 | |
31 |
User | Count |
---|---|
92 | |
81 | |
58 | |
48 | |
48 |