Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Change column value in chart visual using slicer

Hi PBI community,

 

I'm hoping you can help me solve a problem. 

 

As shown in the pbix here: https://www.dropbox.com/s/owfkp1lqdwcusqo/Candlestick%20Question.pbix?dl=0

I have two bar graph visuals (or candlestick charts in this case) where I need to use columns as my fields in the visualization tab. As it stands, I can filter by location, but I cannot figure a way to filter by type A and type B. This would involve being able to dynamically switch between columns fields using slicers, while ensuring that the right columns go into the correct fields (e.g., I have two options for open that should only go into the open field).

 

Can anyone help so that I can show all the information in one graph, with a slicer for building, and for Type A/B?

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous ,

     

    1. Created a new table with a column named "slicer" like the below screenshot with 2 values "AAA' and "BBB".

    2. Created 4 measure like below:

    Close Measure = IF(MAX('Table'[Slicer]) = "AAA",CALCULATE(SUM('Sample'[A Close])),CALCULATE(SUM('Sample'[B Close])))
    
    High Measure = IF(MAX('Table'[Slicer]) = "AAA",CALCULATE(SUM('Sample'[A High])),CALCULATE(SUM('Sample'[B High])))
    
    Low Measure = IF(MAX('Table'[Slicer]) = "AAA",CALCULATE(SUM('Sample'[A Low])),CALCULATE(SUM('Sample'[B Low])))
    
    Open Measure = IF(MAX('Table'[Slicer]) = "AAA",CALCULATE(SUM('Sample'[A Open])),CALCULATE(SUM('Sample'[B Open])))

    3. Put these 4 measures into the chart, then you will get

    Hope this is what you want, please try.

     

    Aiolos Zhao

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    1. Created a new table with a column named "slicer" like the below screenshot with 2 values "AAA' and "BBB".

    2. Created 4 measure like below:

    Close Measure = IF(MAX('Table'[Slicer]) = "AAA",CALCULATE(SUM('Sample'[A Close])),CALCULATE(SUM('Sample'[B Close])))
    
    High Measure = IF(MAX('Table'[Slicer]) = "AAA",CALCULATE(SUM('Sample'[A High])),CALCULATE(SUM('Sample'[B High])))
    
    Low Measure = IF(MAX('Table'[Slicer]) = "AAA",CALCULATE(SUM('Sample'[A Low])),CALCULATE(SUM('Sample'[B Low])))
    
    Open Measure = IF(MAX('Table'[Slicer]) = "AAA",CALCULATE(SUM('Sample'[A Open])),CALCULATE(SUM('Sample'[B Open])))

    3. Put these 4 measures into the chart, then you will get

    Hope this is what you want, please try.

     

    Aiolos Zhao

    • Anonymous's avatar
      Anonymous
      Not applicable

      This worked! Thank you so much!