Forum Discussion

Ashish_Mathur's avatar
Ashish_Mathur
Icon for Super User rankSuper User
1 year ago
Solved

Segment respondents into buckets

Hi,

Given this simple table, i'd like to segment the respondent into 2 buckets - below average and above average.  Please note that since the visual should respond to slicers, I cannot use a calculated column formula - therefore, please share a measure based solution.  Also, rating (second column of base data sheet) is a measure.  Thank you.

 

I am attaching an MS Excel file.

 

Base data

Student Rating
A 4.2
W 3.5
D 4.9
E 4.1
R 3.2
T 3.5
Y 3.9

 

The expected result is this table visual

 

Particulars Count
Below average 4
Above average 3
  • If you need the total to appear in the table as well, try this:

    Count_ = 
    VAR _Avg =
        AVERAGEX (
            ALLSELECTED ( 'Table'[Student] ),
            CALCULATE ( SUM ( 'Table'[Rating] ) )
        )
    VAR _Tbl =
        FILTER (
            SUMMARIZECOLUMNS (
                'Table'[Student],
                "@particulars",
                    IF (
                        CALCULATE ( SUM ( 'Table'[Rating] ) ) < _Avg,
                        "Above average",
                        "Below Average"
                    )
            ),
            [@particulars] IN VALUES ( Particulars[Particulars] )
        )
    RETURN
        COUNTROWS ( _Tbl )
    

     

4 Replies

  • If you need the total to appear in the table as well, try this:

    Count_ = 
    VAR _Avg =
        AVERAGEX (
            ALLSELECTED ( 'Table'[Student] ),
            CALCULATE ( SUM ( 'Table'[Rating] ) )
        )
    VAR _Tbl =
        FILTER (
            SUMMARIZECOLUMNS (
                'Table'[Student],
                "@particulars",
                    IF (
                        CALCULATE ( SUM ( 'Table'[Rating] ) ) < _Avg,
                        "Above average",
                        "Below Average"
                    )
            ),
            [@particulars] IN VALUES ( Particulars[Particulars] )
        )
    RETURN
        COUNTROWS ( _Tbl )