cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
viera00
Helper II
Helper II

Create Matrix with Metric as a Column header

Hello Everyone, hope you are ending a great year.

 

I've a new requirement which I'm struggling to accomplish.

 

We need to add a "metric" as a column header in a matrix.

 

The report table is described in the image.

 

 

 

report-table.JPG

 

 

 

 

 

 

 

 

As you can see I've a dimension client, which I use a column headers, then I have a dimension brands, which I use as row header.
I have a facts table described with this 2 dimensions plus a date dimension.


Then I have 4 metrics (MTD, MTDvs Budget, YTD , YTD Vs Budget). I've already calculated them and they look fine. But the business requires that each Column header to have the % of the total of the column.

 

As you can see in the example, each column header has the value % calculated as (Grand Total MTD / The client total MTD) This is the total of all MTDS of the table, divided the corresponding ones of the client.


Even though Im still working on the metric, my main issue is how to use is as a column header.
Has anyone faced something similar ?

 

Looking forward for your feedback.

Happy new year !

Regards,

GV

German Viera
http://slidemodel.com/
2 REPLIES 2
Greg_Deckler
Super User
Super User

In general, to use a measure in that way, you need to use the Disconnected Table Trick as this article demonstrates: https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick...

 

For you, create a table like:

 

Metric

MTD

MTD Vs Budget

YTD

YTD vs Budget

 

Then you would create a measure that refers to your other measures. So, something along the lines of:

 

Metric to Show = 
VAR __metric = MAX('Table'[Metric])
RETURN
SWITCH(__metric,
  "MTD",[MTD],
  "MTD Vs Budget",[MTD Vs Budget],
  "YTD",[YTD],
  "YTD vs Budget",[YTD vs Budget],
  BLANK()
)

This assumes that you have measures named [MTD], [MTD Vs Budget], etc. You would use the Metric column as a column in your matrix. So, the VAR gets the maximum value, which is to say the value in the column and then uses that to decide which of your 4 measures to display.


@ me in replies or I'll lose your thread!!!
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

 

Thank you for your reply.

 

I'm not sure that this will solve my issue.

 

If you look at the image, I need to show the 4 metrics, for each client. This is not the issue.

What I'm unable to do, is to show the percentage on top of the client. This percentage is a metric, than should vary with the context of the slicers. This metric is variable.  So I'm able to create the metric and use it a a Value of the matrix, but Im unable to use it as a column header in a matrix.

 

Regards,

 

GV

German Viera
http://slidemodel.com/

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Show episode 9

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 26

New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors