Forum Discussion
Creating matrix visual using values as row header/value
- 3 years ago
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]- Zakk20003 years agoRegular Visitor
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.
Column_Person = DISTINCT(UNION(DISTINCT('Table'[Sales By]),DISTINCT('Table'[Being Assistant 1]),DISTINCT('Table'[Being Assitant 2])))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 - Greg_Deckler3 years ago
Community Champion
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]- Zakk20003 years agoRegular Visitor
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