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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
cris007
Frequent Visitor

filter columns and rows of a matrix

Hi all, 

 

Let's say I have the below dataset : 

 

BrandValueCompetitor
Audi5000No
Skoda4000No
VW6000Yes
BMW4000Yes
Peugeot3000Yes
Tesla5000Yes
BYD4000Yes
Citroen1000Yes

 

 

I want to create a Matrix for which in colomns I want to put all the brands that are not competitor and in rows, all the brands that are competitors. 

 

So it would look as below : 

 AudiSkoda
VW  
BMW  
Peugeot  
Tesla  
BYD  
Citroen  

 

 

Anyone knows how I can create a dax to filter my rows and columns? 

 

 

Thank you

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @cris007 ,

 

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
var _table=
SUMMARIZE('Table','Table'[Brand],'Table'[Competitor])
var _tableno=
FILTER(_table,[Competitor]="No")
var _tablenotrue=
SUMMARIZE(_tableno,[Brand])
var _tablenotrue1=
ADDCOLUMNS(
    _tablenotrue,"Brandgroup",[Brand])
var _tablenotrue2=
SUMMARIZE(
    _tablenotrue1,[Brandgroup])
var _tableyes=
FILTER(_table,[Competitor]="Yes")
var _tableyestrue=
SUMMARIZE(_tableyes,[Brand])
return
CROSSJOIN(
    _tablenotrue2,_tableyestrue)

vyangliumsft_0-1688617536654.png

2. Result:

vyangliumsft_1-1688617536655.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @cris007 ,

 

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
var _table=
SUMMARIZE('Table','Table'[Brand],'Table'[Competitor])
var _tableno=
FILTER(_table,[Competitor]="No")
var _tablenotrue=
SUMMARIZE(_tableno,[Brand])
var _tablenotrue1=
ADDCOLUMNS(
    _tablenotrue,"Brandgroup",[Brand])
var _tablenotrue2=
SUMMARIZE(
    _tablenotrue1,[Brandgroup])
var _tableyes=
FILTER(_table,[Competitor]="Yes")
var _tableyestrue=
SUMMARIZE(_tableyes,[Brand])
return
CROSSJOIN(
    _tablenotrue2,_tableyestrue)

vyangliumsft_0-1688617536654.png

2. Result:

vyangliumsft_1-1688617536655.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

OwenAuger
Super User
Super User

Hi @cris007 

To be able to give a proper answer, my first question is: what values would you want to appear in the body of the matrix? Can you give an example?

 

Regardless, I would suggest that you need a secondary copy of a Brand dimension (possibly with inactive relationship) in order to make this work.

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Helpful resources

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

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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