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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
mehlenbae2
Helper II
Helper II

Need to create measure

I am trying to replicate this Excel Pivot Table in PBI by using a matrix:

mehlenbae2_0-1664280120381.png

 

 

Here is my table:

mehlenbae2_1-1664280120322.png

 

 

My issue is that I need to create a measure to calculate average Customer Satisfaction for each Product Type because of conditional formatting (each product type has different customer satisfaction target). However, when I average a product type it looks at the entire table instead of the rows that specify the a particular Target Type. Keep in mind I need all of the Product Type values in the Matrix seperately. I am aware that it works perfectly when you put Product Type as Columns and average it that way however conditional formatting will not work the way I want it.

 

I would attach my test PBI but am not sure how.. Here is a picture:

mehlenbae2_2-1664280120406.png

 

Please help. I've been working at this for awhile.

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @mehlenbae2 

 

You need to transform the table with Power Query Editor first. This will make it easy to achieve your expected result. Please follow these steps:

 

1. Select four "Product Type X" columns and unpivot them. You will have a new "Attribute" column and a "Value" column. 

vjingzhang_0-1664442144859.png

 

2. Filter rows by "Attribute" column via Ends With. You can enter any value here e.g. "A". We will modify this value later. 

vjingzhang_1-1664442431875.png

 

3. In formula bar, replace "A" with [Product Type]. This is to filter rows whose "Product Type" is identical with the product type value in "Attribute".

vjingzhang_2-1664442790684.png

 

4. Now the table is friendly to be used in a matrix. Apply this change to Power BI Desktop. Then create a matrix with below fields. 

vjingzhang_4-1664443186199.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @mehlenbae2 

 

You need to transform the table with Power Query Editor first. This will make it easy to achieve your expected result. Please follow these steps:

 

1. Select four "Product Type X" columns and unpivot them. You will have a new "Attribute" column and a "Value" column. 

vjingzhang_0-1664442144859.png

 

2. Filter rows by "Attribute" column via Ends With. You can enter any value here e.g. "A". We will modify this value later. 

vjingzhang_1-1664442431875.png

 

3. In formula bar, replace "A" with [Product Type]. This is to filter rows whose "Product Type" is identical with the product type value in "Attribute".

vjingzhang_2-1664442790684.png

 

4. Now the table is friendly to be used in a matrix. Apply this change to Power BI Desktop. Then create a matrix with below fields. 

vjingzhang_4-1664443186199.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Hi @mehlenbae2 

 

Update:

 

I found another solution that you don't need to transform the table. You can use the "Customer Satisfaction Met" column for average value directly.

vjingzhang_0-1664444019369.png

 

I have attached a pbix file with both samples.

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

MFelix
Super User
Super User

Hi @mehlenbae2 

 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


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



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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