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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
kbauro97
New Member

Database design and modeling

Hi, 
I want to create a dashboard where I would have a matrix with the categories divided per date and its chart per date and value.
For example, I would have a table with the countries, then I would find the cities, and then the division per indicators. 

kbauro97_1-1643089225740.png


I have two options. In the first table, I have in the first column the date and the next columns the values for Country/City/Indicator combination. I will have many combinations and I want to have all the values from all the year in the table. 

 

CountryMexicoMexicoUSAUSA
CityCdmxCdmxNYCNYC
IndicatorPeopleQualityPeopleQuality
01-01-221001015010
02-01-222002025020
03-01-223001035010
04-01-224002045020
05-01-225001055010
06-01-226002065020
07-01-227001075010
08-01-228002085020

Vertical


In the second option, I have the categories in columns (country, city, indicator) and one date per column.

CountryCityIndicator01-01-2202-01-2203-01-2204-01-2205-01-2206-01-2207-01-2208-01-22
MexicoCdmxPeople100200300400500600700800
MexicoCdmxQuality1020102010201020
USANYCPeople150250350450550650750850
USANYCQuality1020102010201020

Horizontal

 

Which database design should I use in order to have the dates- country/city/indicator matrix table?

How can I create the data model in order to use a matrix chart?

I hope you can help me to solve this issue. Thank you.

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@kbauro97 , You have to unpivot the tables and bring city and date on rows.

 

https://radacad.com/pivot-and-unpivot-with-power-bi

 

Then create common dimensions like city and date join with both tables and use those

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Anonymous
Not applicable

Hi @kbauro97 ,

 

The second one. Open query editor and selecte the first three columns and use unpivot other columns feature.

1.PNG

Then you will get a table like below and you will be able to create matrix the visual that you wanted.

2.PNG3.PNG

 

Best Regards,

Jay

View solution in original post

3 REPLIES 3
kbauro97
New Member

Thank you. I didn't know that feature, it is really helpful

Anonymous
Not applicable

Hi @kbauro97 ,

 

The second one. Open query editor and selecte the first three columns and use unpivot other columns feature.

1.PNG

Then you will get a table like below and you will be able to create matrix the visual that you wanted.

2.PNG3.PNG

 

Best Regards,

Jay

amitchandak
Super User
Super User

@kbauro97 , You have to unpivot the tables and bring city and date on rows.

 

https://radacad.com/pivot-and-unpivot-with-power-bi

 

Then create common dimensions like city and date join with both tables and use those

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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