Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I have 2 tables for data in tables Data2 and Data3. In Data2 table, there are two values and in Data3 there is only one value. I want to show the values and month in such format in a matrix:
| 07.2020 | 08.2020 |
Amount1 |
|
|
Amount2 |
|
|
Amount3 |
|
|
I tried to merge tables but it is not really working, because of the structure of the tables. Data2 table calculates Region values based on sum of county values. Data3 table doesn’t have this logic. It has its own value. Therefore, it is not really east to handle.
Do you have any ideas or suggestions?
Thanks in advance!
Example:
Data2 Table:
RegionCountyMonthAmount1Amount2
| AF | 1 | 07.2020 | 12 | 44 |
| AF | 2 | 07.2020 | 13 | 43 |
| EU | 3 | 07.2020 | 22 | 41 |
| EU | 4 | 07.2020 | 21 | 55 |
| AS | 5 | 07.2020 | 33 | 56 |
| AS | 6 | 07.2020 | 32 | 65 |
| AF | 1 | 08.2020 | 14 | 46 |
| AF | 2 | 08.2020 | 15 | 45 |
| EU | 3 | 08.2020 | 24 | 43 |
| EU | 4 | 08.2020 | 23 | 57 |
| AS | 5 | 08.2020 | 35 | 58 |
| AS | 6 | 08.2020 | 34 | 67 |
Data3 Table:
RegionCountyMonthAmount3
| AF | 1 | 07.2020 | 12 |
| AF | 2 | 07.2020 | 13 |
| AF | # | 07.2020 | 20 |
| EU | 3 | 07.2020 | 22 |
| EU | 4 | 07.2020 | 21 |
| EU | # | 07.2020 | 40 |
| AS | 5 | 07.2020 | 33 |
| AS | 6 | 07.2020 | 32 |
| AS | # | 07.2020 | 60 |
| AF | 1 | 08.2020 | 14 |
| AF | 2 | 08.2020 | 13 |
| AF | # | 08.2020 | 25 |
| EU | 3 | 08.2020 | 25 |
| EU | 4 | 08.2020 | 21 |
| EU | # | 08.2020 | 45 |
| AS | 5 | 08.2020 | 36 |
| AS | 6 | 08.2020 | 32 |
| AS | # | 08.2020 | 65 |
Solved! Go to Solution.
Hi @IF ,
Pls change the Cardinality from many to one to many to many,in the sample data,it's a many to one relationship,but in your real data,I'm afraid it should be a many to many relationship.
Hi @IF ,
Create a new table as below:
New Table = ADDCOLUMNS('Data3',"Amount1",RELATED(Data2[Amount1]),"Amount2",RELATED(Data2[Amount2]))
And a slicer table as below:
Then create a measure as below:
Measure = SWITCH(SELECTEDVALUE('Slicer Table'[Category]),"Amount1",CALCULATE(SUM('New Table'[Amount1]),FILTER(ALL('New Table'),'New Table'[Month]=MAX('New Table'[Month]))),
"Amount2",CALCULATE(SUM('New Table'[Amount2]),FILTER(ALL('New Table'),'New Table'[Month]=MAX('New Table'[Month]))),
"Amount3",CALCULATE(SUM('New Table'[Amount3]),FILTER(ALL('New Table'),'New Table'[Month]=MAX('New Table'[Month]))))
And you will see:
For the related .pbix file,pls see attached.
Hi,
Thanks, but I am confused with the rea data.
When I try with the real data, I can not connect those to tables as you connected. In your way, I see the connection is different such as:
But I can not do similar relationship between to tables that provide data.
Is there any way to solve this problem? I cannot event make the new table since there is no relationship between to data table.
Regards,
Hi @IF ,
Pls change the Cardinality from many to one to many to many,in the sample data,it's a many to one relationship,but in your real data,I'm afraid it should be a many to many relationship.
Hi,
I can try it but not sure about the performance issue as I have quite big data.
Thanks for the reply!
@IF , if you want separate region and country , you can do like
region = distinct(union(all(Data2[Region]),all(Data2[Region])))
County = distinct(union(all(Data2[County]),all(Data2[County])))
For combined Region,County you need to create a combined key and then you use selectcolumns to get two columns in union
For Date use date table
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...
Appreciate your Kudos.
Hi,
Thanks for the answer!
I am not sure if I get you. I have new tables added, but next stage?? I uploaded the file to:https://gofile.io/d/rqKq2j
if it helps.
All the best,
@IF Not sure you could get the rows the way you want them in a matrix visual the way you have it now. Maybe try unpivoting your Amount1 and Amount2 columns and then try your Merge? Although not sure why your merge wouldn't work as is and then unpivot your amount columns. Perhaps you need a combo key before you merge of Region and County together?
Hi,
I could unpivot the amount columns from the same table but later on I can not show all three amount in a matrix.
Thanks for the answer.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.