Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi All,
I am stuck on creating a visual using Matrix.
Sample Data:
Case No. | Sales by | Being Assistant 1 | Being Assistant 2 |
1A | Person A | Person B | Person C |
2B | Person A | Person B | Person C |
3C | Person B | Person C | Person D |
4D | Person B | Person C | Person D |
5E | Person C | Person D | Person A |
6 | Person C | Person D | Person A |
7 | Person D | Person A | Person B |
I am trying to translate on how many case for a person have done for each "sales by", "being assitant 1" and "being assistant 2".
Intended Matrix:
Person | Sales by | Being Assitant 1 | Being Assistant 2 | Total Cases |
Person A | 2 | 1 | 2 | 5 |
Person B | 2 | 2 | 1 | 5 |
Person C | 2 | 2 | 2 | 6 |
Person D | 1 | 2 | 2 | 5 |
Appreciate all the help on this.
Solved! Go to Solution.
@Zakk2000 I was assuming that you would just use Sales by column in your matrix visual. If for some reason that is not feasible, you could create a new table like this (I would leave as a disconnected table).
Person Table =
DISTINCT(
UNION(
SELECTCOLUMNS('Table',"Person",[Sales By]),
SELECTCOLUMNS('Table',"Person",[Being Assistant 1]),
SELECTCOLUMNS('Table',"Person",[Being Assistant 2]),
)
)
You would change the measures like this:
Sales By Measure =
VAR __Person = MAX('Person Table'[Person])
VAR __Result = COUNTROWS(FILTER(ALL('Table',[Sales By] = __Person
RETURN
__Result
Sales By Being Assistant 1 Measure =
VAR __Person = MAX('Person Table'[Person])
VAR __Result = COUNTROWS(FILTER(ALL('Table'),[Being Assistant 1] = __Person))
RETURN
__Result
Sales By Being Assistant 2 Measure =
VAR __Person = MAX('Person Table'[Person])
VAR __Result = COUNTROWS(FILTER(ALL('Table'),[Being Assistant 2] = __Person))
RETURN
__Result
Total Cases Measure = [Sales By Measure] + [Sales By Being Assistant 1 Measure] + [Sales By Being Assistant 2 Measure]
@Zakk2000 Maybe:
Sales By Measure = COUNTROWS('Table')
Sales By Being Assistant 1 Measure =
VAR __Person = MAX('Table'[Sales by])
VAR __Result = COUNTROWS(FILTER(ALL('Table'),[Being Assistant 1] = __Person))
RETURN
__Result
Sales By Being Assistant 2 Measure =
VAR __Person = MAX('Table'[Sales by])
VAR __Result = COUNTROWS(FILTER(ALL('Table'),[Being Assistant 2] = __Person))
RETURN
__Result
Total Cases Measure = [Sales By Measure] + [Sales By Being Assistant 1 Measure] + [Sales By Being Assistant 2 Measure]
Hi @Greg_Deckler ,
Your solution managed to do on everything for the values side, but I am still struggling on the 'Person' column. I tried to create a new table and merge the columns by distinct 'Person' name.
Person | Sales by | Being Assitant 1 | Being Assistant 2 | Total Cases |
Person A | 2 | 1 | 2 | 5 |
Person B | 2 | 2 | 1 | 5 |
Person C | 2 | 2 | 2 | 6 |
Person D | 1 | 2 | 2 | 5 |
@Zakk2000 I was assuming that you would just use Sales by column in your matrix visual. If for some reason that is not feasible, you could create a new table like this (I would leave as a disconnected table).
Person Table =
DISTINCT(
UNION(
SELECTCOLUMNS('Table',"Person",[Sales By]),
SELECTCOLUMNS('Table',"Person",[Being Assistant 1]),
SELECTCOLUMNS('Table',"Person",[Being Assistant 2]),
)
)
You would change the measures like this:
Sales By Measure =
VAR __Person = MAX('Person Table'[Person])
VAR __Result = COUNTROWS(FILTER(ALL('Table',[Sales By] = __Person
RETURN
__Result
Sales By Being Assistant 1 Measure =
VAR __Person = MAX('Person Table'[Person])
VAR __Result = COUNTROWS(FILTER(ALL('Table'),[Being Assistant 1] = __Person))
RETURN
__Result
Sales By Being Assistant 2 Measure =
VAR __Person = MAX('Person Table'[Person])
VAR __Result = COUNTROWS(FILTER(ALL('Table'),[Being Assistant 2] = __Person))
RETURN
__Result
Total Cases Measure = [Sales By Measure] + [Sales By Being Assistant 1 Measure] + [Sales By Being Assistant 2 Measure]
Hi @Greg_Deckler ,
Your solution helps a lot 🙂
I am confuse with the error by my power BI.
The "total" (bolded) at the bottom of the table that generated by Matrix viz is only showing the last person (Person D). Is there a way to fix this?
Result received:
Person | Sales by | Being Assitant 1 | Being Assistant 2 | Total Cases |
Person A | 2 | 1 | 2 | 5 |
Person B | 2 | 2 | 1 | 5 |
Person C | 2 | 2 | 2 | 6 |
Person D | 1 | 2 | 2 | 5 |
Total | 1 | 2 | 5 |
@Zakk2000 First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e
This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907
Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
94 | |
84 | |
84 | |
73 | |
49 |
User | Count |
---|---|
143 | |
132 | |
110 | |
64 | |
55 |