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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mehlenbae2
Helper II
Helper II

Need help creating a measure

I have a matrix that looks like this:

                  Type A   Type B Type C   Type D Type E Type F

Region 10.00%     
Region 20.00%     
Region 3100.00     

 

I need help creating a matrix that shows percent average for each region and Type. Problem is, each Type has a different target and i'd like to use different conditional formatting for each Type. I created 6 columns that show 1 if we met customer satisfaction and 0 if we did not meet customer satisfaction. However, each type is looking at the whole table instead of its specific type making the number way too small.. How can I remedy this for each type??

4 REPLIES 4
Greg_Deckler
Super User
Super User

@mehlenbae2 Try a single measure like:

Measure =
  VAR __Type = MAX('Table'[Type])
  VAR __Region = MAX('Table'[Region])
  VAR __Target = SWITCH(__Type,
                   "Type A",10,
                   "Type B",20,
                   "Type C",15
                 )
// do some more stuff here based on targets, etc.

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Sorry, I don't think I was clear.  The targets are not the issue- I need to make sure that each SPECIFIC Type gives a percent average based on the type SUM.

 

For example, for Type A (Met Customer Satisfaction = 50 | Did not meet customer satisfaction: 50) 

I need to find the average of Met customer satisfaction and did not meet customer satisfaction which in this example would be 50%^^ then split it up by Region.

 

My issue is that the columns I made look at the entire data set and do not filter the specific Type which makes the average incorrect because it's averaging by rows that are not applicable (other types).  I hope this makes sense. Sorry I am unable to attach the file due to the data sensitivity.

@mehlenbae2 So are the Types actually in your data or are those coming from a disconnected table? Sample data would really help make heads or tails of this. I don't need actual data, just data that replicates the issue or otherwise simulates the data.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

Here is an Excel sheet. I am trying to replicate this in PBI by using a matrix:

mehlenbae2_0-1664278871415.png

 

Here is my table:

mehlenbae2_3-1664279373493.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 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_4-1664279739675.png

Thank you very much!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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