Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

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_A1Q1_A2Q1_A3Date
A70%20%10%1/9/2022
A50%20%30%5/9/2022
A20%20%60%8/9/2022
A50%40%10%13/9/2022
B30%30%30%2/9/2022
B80%10%10%8/9/2022
A20%20%60%20/9/2022
A50%20% 30%25/9/2022
B30%30%40%12/9/2022
B20%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%
  • Anonymous's avatar
    Anonymous
    3 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

  • Anonymous's avatar
    Anonymous
    Not 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

  • Would it be a problem rendering two charts side by side instead?