Reply
kbauro97
New Member
Partially syndicated - Outbound

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

Syndicated - Outbound

@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

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

v-jayw-msft
Community Support
Community Support

Syndicated - Outbound

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
kbauro97
New Member

Syndicated - Outbound

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

v-jayw-msft
Community Support
Community Support

Syndicated - Outbound

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

Syndicated - Outbound

@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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)