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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

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!!!
Instead of a Kudo, please vote for this idea
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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.