Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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.
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
25 | |
20 | |
18 | |
17 | |
16 |
User | Count |
---|---|
37 | |
20 | |
19 | |
17 | |
10 |