March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi, I'll try my best to explain what I need to solve my problem. I have two tables (table1, table2) below. I have a created a relationship between the two tables using the location column. I'm using a stacked bar chart for the visual. What is the best approach to get the right result? Thanks for all your help!
Table 1
Location | Name | Capacity |
A | Apple | 100 |
B | Orange | 75 |
C | Banana | 95 |
D | Pear | 100 |
Table 2
Location | # of Volunteers |
A | 56 |
B | 15 |
C | 42 |
D | 50 |
Solved! Go to Solution.
Create a New Measure: Open the Power BI Desktop, go to the modeling tab, and click on "New Measure". Then, use the following DAX expression:
Total Capacity = SUM('Table1'[Capacity])
This measure will give you the total capacity from Table1.
Create Another Measure: Similarly, create a measure for the total number of volunteers:
Total Volunteers = SUM('Table2'[# of Volunteers])
This measure will give you the total number of volunteers from Table2.
Create a Stacked Bar Chart: Now, you can use these measures in your stacked bar chart. Place the "Location" field from either Table1 or Table2 on the axis, and then add the "Total Capacity" and "Total Volunteers" measures to the Values section of the chart.
This will give you a visual representation of the total capacity and total number of volunteers for each location.
In summary, the key is to create measures that calculate the total capacity and total number of volunteers separately for each table and then use these measures in your visualizations.
OR
This measure will sum the Capacity column from table1 and the # of Volunteers column from table2. The SUMX function iterates over each row of the table and returns the sum of the expression for each row. In this case, the expression is simply the name of the column we want to sum.
I hope this helps! Let me know if you have any other questions.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
Hi, @mason23
Maybe there is no need to create measure.
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for your quick response. I tried both methods and it worked.
Thank you for your quick response. I tried both methods and it worked.
Hi, @mason23
Maybe there is no need to create measure.
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Create a New Measure: Open the Power BI Desktop, go to the modeling tab, and click on "New Measure". Then, use the following DAX expression:
Total Capacity = SUM('Table1'[Capacity])
This measure will give you the total capacity from Table1.
Create Another Measure: Similarly, create a measure for the total number of volunteers:
Total Volunteers = SUM('Table2'[# of Volunteers])
This measure will give you the total number of volunteers from Table2.
Create a Stacked Bar Chart: Now, you can use these measures in your stacked bar chart. Place the "Location" field from either Table1 or Table2 on the axis, and then add the "Total Capacity" and "Total Volunteers" measures to the Values section of the chart.
This will give you a visual representation of the total capacity and total number of volunteers for each location.
In summary, the key is to create measures that calculate the total capacity and total number of volunteers separately for each table and then use these measures in your visualizations.
OR
This measure will sum the Capacity column from table1 and the # of Volunteers column from table2. The SUMX function iterates over each row of the table and returns the sum of the expression for each row. In this case, the expression is simply the name of the column we want to sum.
I hope this helps! Let me know if you have any other questions.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
15 | |
12 | |
9 | |
8 |
User | Count |
---|---|
41 | |
32 | |
29 | |
12 | |
12 |