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

Get 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

Reply
Anonymous
Not applicable

Calculate symmetric mattrix

Hi experts,

 

I'm calculating a symmetric matrix with following tables (It is just a portion of the data):

 

Sport A LabelSport B LabelQtUsersIntersectionQtUsersSportOther
BaloncestoBalonmano16288
BaloncestoeSports29288
BaloncestoFútbol Sala262288
BalonmanoBaloncesto1630
BalonmanoeSports530
BalonmanoFútbol Sala2230
eSportsBaloncesto2950
eSportsBalonmano550
eSportsFútbol Sala2950
Fútbol SalaBaloncesto262294
Fútbol SalaBalonmano22294
Fútbol SalaeSports29294

 

The column "QtUsersSportOther" is comming from another table, and looks like this:

sportQtUser
Baloncesto288
Balonmano30
eSports50
Fútbol Sala294

 

My measure is as follows :

% us = CALCULATE(DIVIDE(SUM(SportsIntersection[QtUsersIntersection]);Sum(SportsIntersection[QtUsersSportOther]); 0))

and I want to create a symetric matrix. The output I'm getting is:

 

output.png

 

However, as it is a symetric matrix, It should look like this:

expected tab.png

I've created this ilustration to explain what I have in mind, but I can't get to translate to DAX, so I need help in this:

 

calculo.png

From the table above, from sport A ("Baloncesto") and SportB ("Futbol Sala"); and "Balonmano" and "Futbol Sala"; and "eSport" and "Futbol Sala" are already calculated, fill with blank all the rows related to the column SportA to "Futbol Sala" and so on.

 

I'm really stuck with this. Any suggestion?

Hope I've made myself understood.

1 ACCEPTED SOLUTION
Cmcmahan
Resident Rockstar
Resident Rockstar

Sure.  Is your visual always going to have the fields in alphabetical order? If so, you just need a minor change to your measure. Otherwise, you'll need some sort of other ranking system to let PowerBI know the order of the categories.

 

% us = CALCULATE(DIVIDE(SUM(SportsIntersection[QtUsersIntersection]);Sum(SportsIntersection[QtUsersSportOther]); 0); FILTER(SportsIntersection; SportsIntersection[Sport A Label]< SELECTEDVALUE(SportsIntersection[Sport B Label])))

View solution in original post

1 REPLY 1
Cmcmahan
Resident Rockstar
Resident Rockstar

Sure.  Is your visual always going to have the fields in alphabetical order? If so, you just need a minor change to your measure. Otherwise, you'll need some sort of other ranking system to let PowerBI know the order of the categories.

 

% us = CALCULATE(DIVIDE(SUM(SportsIntersection[QtUsersIntersection]);Sum(SportsIntersection[QtUsersSportOther]); 0); FILTER(SportsIntersection; SportsIntersection[Sport A Label]< SELECTEDVALUE(SportsIntersection[Sport B Label])))

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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