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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
deb_power123
Helper V
Helper V

Table matrix custom representation - using any possible DAX queries

Hi All,

 

I have the below source table as my input which is a table matrix with a set of 5 coulmns namely :- Name ,city, school,Age,type etc.

 

Input source table:

NamecityschoolAgetype
ALondonABC12Permanent
BBerlinADE10Temporary

 

Output expected:

Namecity
ALondon
schoolABC
Age12
typePermanent
Namecity
BBerlin
schoolADE
Age10
typeTemporary

 

Is it possible to get the expected output in the given format above .Each row should breakdown into row and column[contianing the row values].Is it possible through any DAX assuming the row headers and column headers wont change anytime in future and no new enteries will be added.

 

Kind regards

Sameer

4 REPLIES 4
VahidDM
Super User
Super User

Hi @deb_power123 

 

Try this code to add a new table:

Table 2 = 
Var _A = filter('Table','Table'[Name]="A")
Var _B = filter('Table','Table'[Name]="B")
return
UNION(
    row("Name",MAXX(_A,[Name]),"City",MAXX(_A,[city])),
    row("Name","School","City",MAXX(_A,[school])),
    row("Name","Age","City",MAXX(_A,[Age])),
    row("Name","Type","City",MAXX(_A,[type])),
    row("Name",MAXX(_B,[Name]),"City",MAXX(_B,[city])),
    row("Name","School","City",MAXX(_B,[school])),
    row("Name","Age","City",MAXX(_B,[Age])),
    row("Name","Type","City",MAXX(_B,[type]))
)

 

Output:

VahidDM_0-1636152821578.png

 

 

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

Appreciate your Kudos!!

 

Hi @VahidDM 

Two things I observed below :-

 

1) Can we show this in the table visual , the same way you showed in tranformation tab.I need the same representation in table visual in PowerBI?

 

2) You have represented the above calculation with two variables A and B , what if there are 100 such enteries . I beleive we cannot define 100 variables or even more to handle it in that case so can we use some possible iterations to handle it?

 

If so ,then could you please let me know in your above apporach how to make the changes incase there are 100 entries which we need to show in the same format you have shown for two enteries.? Please suggest.

 

I will wait for your response on this..

 

 

Thankyou very much for the first approach but it will be great if we can know how to handle more number of entires?say 100 or may be more.

Kind regards

Sameer

Hi @deb_power123 

 

1) You can use new table's columns to create a table visual in Power BI.

2) it's hard to solve that with DAX, can you use Power Query?

 

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

 

Appreciate your Kudos!!

 

Hi @VahidDM 

Yes powerquery is also fine.Can you please demonstrate me how to do it using the above input source.I am kind of struggling to conclude this

Kind regards

Sameer

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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