Forum Discussion

Researcher93's avatar
Researcher93
New Member
3 years ago
Solved

Calculate Score

Hello comunity, I have a table that looks like the table below. In this table we have questions (N1, N2, N3 and N4) of which N1 has 3 questions, N2 one question, N3 one question and N4 2 questions. ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Researcher93 ,

     

    You may calculate 4 measures.

     

    N1Score =
    ROUNDDOWN (
        DIVIDE (
            CALCULATE (
                COUNT ( 'Table'[Qestion] ),
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    [Id_answer] = MAX ( 'Table'[Id_answer] )
                        && [Qestion] = "N1"
                        && [Answer] = "OK"
                )
            ),
            3
        ),
        2
    )
    
    N2Score =
    IF (
        [N1Score] = 1,
        IF (
            CALCULATE (
                COUNT ( 'Table'[Qestion] ),
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    [Id_answer] = MAX ( 'Table'[Id_answer] )
                        && [Answer] = "OK"
                        && [Qestion] = "N2"
                )
            ) = 1,
            2,
            1
        )
    )
    

     

    N3Score = 
    IF (
        [N1Score] = 1
            && [N2Score] = 2,
        IF (
            CALCULATE (
                COUNT ( 'Table'[Qestion] ),
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    [Id_answer] = MAX ( 'Table'[Id_answer] )
                        && [Answer] = "OK"
                        && [Qestion] = "N3"
                )
            ) = 1,
            3,
            2
        )
    )
    
    N4Score = 
    IF (
        [N1Score] = 1
            && [N2Score] = 2
            && [N3Score] = 3,
        IF (
            CALCULATE (
                COUNT ( 'Table'[Qestion] ),
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    [Id_answer] = MAX ( 'Table'[Id_answer] )
                        && [Answer] = "OK"
                        && [Qestion] = "N4"
                )
            ) = 1,
            4,
            3.5
        )
    )
    

     

     

     

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.