Forum Discussion
How to create two 100% stacked bar chart with current and last result if filter Name
I would like to show two 100% stacked bar chart with current result and latest last result, and when I filter the name then I can show the two charts automatically. Below is the sample data:
| Name | Q1_A1 | Q1_A2 | Q1_A3 | Date |
| A | 70% | 20% | 10% | 1/9/2022 |
| A | 50% | 20% | 30% | 5/9/2022 |
| A | 20% | 20% | 60% | 8/9/2022 |
| A | 50% | 40% | 10% | 13/9/2022 |
| B | 30% | 30% | 30% | 2/9/2022 |
| B | 80% | 10% | 10% | 8/9/2022 |
| A | 20% | 20% | 60% | 20/9/2022 |
| A | 50% | 20% | 30% | 25/9/2022 |
| B | 30% | 30% | 40% | 12/9/2022 |
| B | 20% | 20% | 60% | 18/9/2022 |
The expected outcome should be when i filter A in the report view, it return two 100% stacked bar chart, one with
| 20% | 20% | 60% |
and one with
| 50% | 20% | 30% |
when i filter B in the report view, it return two 100% stacked bar chart, one with
| 30% | 30% | 40% |
and one with
| 30% | 30% | 40% |
- Anonymous3 years ago
Hi Anonymous,
You can do unpivot column on your 'Quarter' fields to convert them to attribute and value. then use the date on your chart axis and attribute the legends, and value to the value fields.
Unpivot columns (Power Query) (microsoft.com)
After these steps, you need to write a measure filter to check corresponding date ranges and return tags then use it on the chart to filter matched records to cooperate with the Name filter to achieve your requirements.Applying a measure filter in Power BI - SQLBI
Regards,
Xiaoxin Sheng
2 Replies
- AnonymousNot applicable
Hi Anonymous,
You can do unpivot column on your 'Quarter' fields to convert them to attribute and value. then use the date on your chart axis and attribute the legends, and value to the value fields.
Unpivot columns (Power Query) (microsoft.com)
After these steps, you need to write a measure filter to check corresponding date ranges and return tags then use it on the chart to filter matched records to cooperate with the Name filter to achieve your requirements.Applying a measure filter in Power BI - SQLBI
Regards,
Xiaoxin Sheng
- lbendlin
Super User
Would it be a problem rendering two charts side by side instead?