Forum Discussion
Issues in Matrix visual
- 6 years ago
simrantuli - I did it like the following:
Measure = VAR __Key = MAX('Table'[#Key_Site_Supplier]) VAR __Site = MAX('Table (2)'[Site]) RETURN MAXX(FILTER('Table (2)',[#Key_Site_Supplier] = __Key && [Site] = __Site),[Supplier])PBIX is attached below sig.
Also, you could achieve this just using "First Supplier" if you make your relationship filter direction "Both". Then you don't need the DAX. But, if for some reason you can't do that in your model, the DAX should work.
Hi Fowmy,
I am not expecting multiple values in Matrix as if you see the data also, there are no multiple suppliers for a single site and service combination.
Please find below the data.
'Table' table:
Service #Key_Site_Supplier
| Food | A1##A |
| AV | A2##B |
| Fitness | A3##C |
| Food | B1##D |
| Fitness | B2##A |
| Food | B3##A |
| Fitness | B3##A |
| AV | B3##B |
| AV | B4##A |
| Food | B4##B |
'Mapping' table:
Site Supplier #Key_Site_Supplier
| A1 | A | A1##A |
| A2 | B | A2##B |
| A3 | C | A3##C |
| B1 | D | B1##D |
| B2 | A | B2##A |
| B3 | A | B3##A |
| B3 | B | B3##B |
| B4 | A | B4##A |
| B4 | B | B4##B |
Best Regards
Simran Tuli
simrantuli
Do you have a single table or two tables with a relationship?
You can share both if so
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply š
- simrantuli6 years agoContinued Contributor
Hi Fowmy,
I have two tables with a relationship.
'Table' table:
Service #Key_Site_Supplier
Food A1##A AV A2##B Fitness A3##C Food B1##D Fitness B2##A Food B3##A Fitness B3##A AV B3##B AV B4##A Food B4##B 'Mapping' table:
Site Supplier #Key_Site_Supplier
A1 A A1##A A2 B A2##B A3 C A3##C B1 D B1##D B2 A B2##A B3 A B3##A B3 B B3##B B4 A B4##A B4 B B4##B I want to show 'Site' as Row, Service as 'Column' and 'Suppliers' as Values in Matrix.
Thanks!
- Greg_Deckler6 years agoCommunity Champion
simrantuli - I did it like the following:
Measure = VAR __Key = MAX('Table'[#Key_Site_Supplier]) VAR __Site = MAX('Table (2)'[Site]) RETURN MAXX(FILTER('Table (2)',[#Key_Site_Supplier] = __Key && [Site] = __Site),[Supplier])PBIX is attached below sig.
Also, you could achieve this just using "First Supplier" if you make your relationship filter direction "Both". Then you don't need the DAX. But, if for some reason you can't do that in your model, the DAX should work.
- simrantuli6 years agoContinued Contributor
Greg_Deckler You are AWESOME!
It worked. Thank you so much!
Just one question. Why doesn't the below measure work in this case? What's the issue? If you could explain.
SELECTEDVALUE(Mapping[Supplier])
Thanks!