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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
GG3Jables
Regular Visitor

Convert String from Database Entries into Matrix Visual

Hi! 

I am pretty new to Power BI and need some help for an evaluation I want to to, for a problem I am struggling with at the moment. 

Basically I have a big database, in which type of same strings are collected in several columns like underneath: 

ID
 Rack1
Rack2
Rack3
1
Coke; Sprite
0
0
2
0
Pepsi
0
3
Pepsi; Coke
Sprite
Coke

 

All I want to do is to count the single strings and collect them in a matrix visual like here: 

Type
Rack1
Rack2
Rack3
Coke
2
0
1
Sprite
1
1
0
Pepsi
1
1
0

 

Can someone please explain if and how it is possible to convert the data into a matrix visual? 

 

Greets ! 

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @GG3Jables 

 

In the query editor, you can unpivot all other columns than ID, split the resulting value column into rows and do some cleaning before loading then into the model.  And here's the result:

danextian_0-1736341604865.png

Note: Ideally transformations should be done at the source and since you mentioned that it is in a big database, expect for slow loading/data refresh.

 

Sample pbix attached.

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi, @GG3Jables 

May I ask if you have gotten this issue resolved? If it is solved, please share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.


If it is not resolved, I hope you will provide the full .pbix file via OneDrive or SharePoint. Please be careful to remove all sensitive information and we will do our best to provide ideas for your issue.

 

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, @Anonymous

I am still wortking on the unpivot solution of @danextian

That will take some time because I am still a beginner in DAX and Power BI, but I will keep this updated! 

 

Unfortunately due to company restrictions I cant share the database, but I will trry to crate a smaller but similiar database and add it to the post

GG3Jables
Regular Visitor

@danextian : Thank you very much for the reply!

I tried it on a small sample database and it worked exactly like you described, but when used in my big database the distinct count function doesn´t work properly anymore. 

But nevertheless thank you very much ! 

Sorry, is it the distinct count function that didn't work (very unlikely) or you couldn't unpivot due to sheer size of the data?





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

So the problem is that when I unpivot the database, the rows without an entry are not reconsidered. 

Unfortunately I can´t upload a file directly and can´t upload data in google drive or sharepoint due to company IT restrictions. 

Before unpivot the measure for ID count is 2745, afterwards its 210.

 

How do I have to do the unpivot to get those? 

Update: Found the problem, because the fields were filled with "null" they were not reconsidered. 

After exchange with "0" it worked just like @danextian said before :). 

 

@danextian : Again, thank you very much ! 

danextian
Super User
Super User

Hi @GG3Jables 

 

In the query editor, you can unpivot all other columns than ID, split the resulting value column into rows and do some cleaning before loading then into the model.  And here's the result:

danextian_0-1736341604865.png

Note: Ideally transformations should be done at the source and since you mentioned that it is in a big database, expect for slow loading/data refresh.

 

Sample pbix attached.

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.