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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
simrantuli
Continued Contributor
Continued Contributor

Issues in Matrix visual

Hi All,

 

I am facing an issue while trying to show some information in 'Matrix'. 

So, I have below two tables.

simrantuli_0-1596963360985.png

'Table' table:

simrantuli_1-1596963415382.png

'Mapping' table:

simrantuli_2-1596963449218.png

What I want to show in 'Matrix' visual is 'Site' as Row, 'Service' as Column and 'Supplier' as Value.

So, for Value, I have written the below DAX and used it in 'Value' in Matrix but it doesn't show me the correct information.

Supplier_Name = SELECTEDVALUE(Mapping[Supplier])
 
 

So basically, Matrix doesn't show values for 'B3' and 'B4'. And for others too, it doesn't show correct values.

 

Your help would be greatly appreciated 🙂

 

Best Regards

Simran Tuli

 

 

1 ACCEPTED SOLUTION

@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.


@ 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...

View solution in original post

9 REPLIES 9
simrantuli
Continued Contributor
Continued Contributor

This is the output that I am getting. The values are not showing correct.

simrantuli_0-1596964455003.png

 

@simrantuli 

If you are expecting multiple supplier values to come in the value areas, try the following measure.

Share data in Excel format or just paste in the reply to box to check further.

Supplier_Name = 
CONCATENATEX(
    VALUES(Mapping[Supplier]),
    Mapping[Supplier],
    UNICHAR(10)
)

 

________________________

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 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

simrantuli
Continued Contributor
Continued Contributor

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

FoodA1##A
AVA2##B
FitnessA3##C
FoodB1##D
FitnessB2##A
FoodB3##A
FitnessB3##A
AVB3##B
AVB4##A
FoodB4##B

 

'Mapping' table:

 

Site Supplier #Key_Site_Supplier

A1AA1##A
A2BA2##B
A3CA3##C
B1DB1##D
B2AB2##A
B3AB3##A
B3BB3##B
B4AB4##A
B4BB4##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 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

simrantuli
Continued Contributor
Continued Contributor

Hi @Fowmy,

 

I have two tables with a relationship.

'Table' table:

 

Service   #Key_Site_Supplier

FoodA1##A
AVA2##B
FitnessA3##C
FoodB1##D
FitnessB2##A
FoodB3##A
FitnessB3##A
AVB3##B
AVB4##A
FoodB4##B

 

'Mapping' table:

 

Site Supplier #Key_Site_Supplier

A1AA1##A
A2BA2##B
A3CA3##C
B1DB1##D
B2AB2##A
B3AB3##A
B3BB3##B
B4AB4##A
B4BB4##B

 

I want to show 'Site' as Row, Service as 'Column' and 'Suppliers' as Values in Matrix.

 

Thanks!

@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.


@ 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 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!

@simrantuli - I will have to test but off the top of my head, I would say it is because your relationship between your tables is not set to a filter direction of Both. You want 2 arrows pointing in each direction on your relationship. If not that it could be that SELECTEDVALUE is finding multiple items but in that case it would return blank by default I believe. 


@ 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...

Thanks @Greg_Deckler 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.