Forum Discussion

Rate's avatar
Rate
Helper III
7 years ago
Solved

Help with Grouping Answers by Question ID

Hello all!    I am having trouble with a calculation for a big survey we did in our Company. Could you please give help me this?   I have the following Tables: 1. Responses Lines - 1 line per an...
  • MFelix's avatar
    MFelix
    7 years ago

    Hi Rate ,

     

    First of all sorry for the delay, a hard week at work.

     

    Create the following table to use on your slicer:

     

    Type Promotros Detractors
    Strenght 0,75 0,15
    Weaknessess 0,5 0,25

     

    the values on the Promotors and detractors will serve as bounderies that you want to set on your slicer

     

    Create the following measures:

     

    Passive =
    CALCULATE (
        COUNT ( Responses[question_id] );
        Responses[NPS Literal] = "Passive"
    )
        / CALCULATE ( COUNT ( Responses[question_id] ) )
    
    
    Detractor=
    CALCULATE (
        COUNT ( Responses[question_id] );
        Responses[NPS Literal] = "Detractors"
    )
        / CALCULATE ( COUNT ( Responses[question_id] ) )
    
    
    Promotor=
    CALCULATE (
        COUNT ( Responses[question_id] );
        Responses[NPS Literal] = "Promotor"
    )
        / CALCULATE ( COUNT ( Responses[question_id] ) )
    
    
    Filter =
    SWITCH (
        TRUE ();
        SELECTEDVALUE ( Rules[Type] ) = "Strenght"; IF (
            [Promotor] > MIN ( Rules[Promotors] )
                && [Detractor] < MIN ( Rules[Detractors] );
            1;
            0
        );
        SELECTEDVALUE ( Rules[Type] ) = "Weaknessess"; IF (
            [Promotor] < MIN ( Rules[Promotors] )
                && [Detractor] > MIN ( Rules[Detractors] );
            1;
            0
        );
        1
    )

     

    Create a 100% Stacked bar chart and place the measures Detractor, Passive and Promotor on the values and question name on the x-axis. On the Visual filter place the measure Filter and choose the option is 1:

     

    This should give the expected result, see attach PBIX file.

     

     

    Regards,

    MFelix