Forum Discussion

russm's avatar
russm
Helper I
10 years ago
Solved

Calculating modes

What is the best way to calculate the mode (central tendency measure) from an unpivoted column of numerical data (e.g., Likert response values) in Power BI?

 

Thanks,

 

Russ

  • Anonymous's avatar
    Anonymous
    10 years ago

    russm perhaps the solution offered on this article.

     

    Mode :=
    MINX (
        TOPN (
            1,
            ADDCOLUMNS (
                VALUES ( Data[Value] ),
                "Frequency", CALCULATE ( COUNT ( Data[Value] ) )
            ),
            [Frequency],
            0
        ),
        Data[Value]
    )

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    russm perhaps the solution offered on this article.

     

    Mode :=
    MINX (
        TOPN (
            1,
            ADDCOLUMNS (
                VALUES ( Data[Value] ),
                "Frequency", CALCULATE ( COUNT ( Data[Value] ) )
            ),
            [Frequency],
            0
        ),
        Data[Value]
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      It worked

       

      Thank you very much

    • christinek's avatar
      christinek
      Frequent Visitor

      Hi KHorseman, I am new to the Power BI Community forum and not sure if this is correct etiquette or not to reply to this post. Please let me know if not. I found this post in my search to calculate 'Mode'. But when I use the solution, I get an error "Function ADDCOLUMNS expects a column name as argument number 4."

      Are you able to shed any light on where I have gone wrong please?