Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

How to output multiple selections on a single chart using a switch statement

Hi,

 

So I have some selection buttons created from a switch statement in my report. The statement I have used is the following; 

 

Selection =
SWITCH( TRUE(),
VALUES( 'Metric Selection'[Metric] ) = "Quality", Quality[TotalAvgQualityperAgents],
VALUES( 'Metric Selection'[Metric] ) = "PCS", PCS[TotalAvgPCSperAgent],
VALUES( 'Metric Selection'[Metric] ) = "Sales", Sales[TotalSales],
0)

 

So in a line chart I have this 'Selection' measure in the values section. This selection button works great when either one of the 'Quality', 'PCS' or 'Sales' button is selected individualy, and updates the chart accordingly. However I need to add a sepereate 'All' button that will update the chart and display all values (individual lines) on the single line chart. 

 

Is there any mdifications I can add to the switch statement that will permit this? What I want to avoid is values of each measure to be summed up together into one line one the chart.

 

Any advice would be very much appreciated. Let me know if any further clarification is required.

 

Thanks

  • tex628's avatar
    tex628
    8 years ago
    MeasureQuality =
    IF(Selected value('Metric selection'[Metric]="ALL");
    Quality[TotalAvgQualityperAgent];
    Blank()
    )

    Then include an "ALL" button aswell? 

9 Replies

  • v-frfei-msft's avatar
    v-frfei-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous,

     

    Unfortunately, it is really impossible to meet your requirement and there is no proper way to work around. As the measure cannot be treated as category, so we cannot display all values in individual lines, and they will be summed up by default. 

     

    Regards,

    Frank

  • tex628's avatar
    tex628
    Icon for Community Champion rankCommunity Champion

    I dont know if this will work but you could try something like this:

     

    MeasureQuality =
    IF(Selected value('Metric selection'[Metric]);
    Blank();
    Quality[TotalAvgQualityperAgent]
    )

    This should return blank() if metric selection is filtered and otherwise show the Quality value. 
    Create one measure for each value and include them in the linechart.

     

    Br,

    J

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you. This logically sounds promising. However I am receiving error when adding both to the values pane;

       

       

      Ive tried changing the blank() to 0 but this still prompts same error. Any ideas?

      • tex628's avatar
        tex628
        Icon for Community Champion rankCommunity Champion
        MeasureQuality =
        IF(Selected value('Metric selection'[Metric]<>Blank());
        Blank();
        Quality[TotalAvgQualityperAgent]
        )

        Try this! :)