Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

How do i compute average score

Hi guys!

 

Need help on this.

I am trying to create a customer dashboard based on scoring of each customer. So when i filter to customer A for example, it will show a simple average of A score, B score and total of A and B score on card visuals. May i know what kind of measures or dax will make it possible?

Thanks!

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

    Please try below steps:

    1. below is my test table

    Table:

    2. create three measure with below dax formula

    Avg for A Score =
    VAR cur_ct =
        SELECTEDVALUE ( 'Table'[Customer] )
    VAR tmp =
        FILTER ( ALL ( 'Table' ), 'Table'[Customer] = cur_ct )
    RETURN
        AVERAGEX ( tmp, [A Score] )
    
    Avg for B Score =
    VAR cur_ct =
        SELECTEDVALUE ( 'Table'[Customer] )
    VAR tmp =
        FILTER ( ALL ( 'Table' ), 'Table'[Customer] = cur_ct )
    RETURN
        AVERAGEX ( tmp, [B Score] )
    
    Avg Score for Total = [Avg for A Score]+[Avg for B Score]

    3. add a slicer with "Table[Customer]" column, add three card visual with above measure, add a table visual with fields

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_ Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    ā€ƒ

4 Replies

  • Anonymous , Try like

     

    Averagex(Summarize(Table, Table[Customer], Table[Invoice Number]), calculate(Sum(Table[A Score]) + Sum(Table[A Score]) ) )

     

     

    If this does not help
    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Amit

     

    Not sure if you get my requirements right, based on below table date, if i filter for customer A, i will see 1.75 (average of 1.5 and 2) in A score card, 2.15 (based on average of 2.1 and 2.2) in B score card, and 3.9 in the total score card. In this case, how many measures should i be creating and what will the DAX look like? Thanks alot!

     

    CustomerInvoice NumberA ScoreB Score

    A

    12341.5 
    A2234 2.1
    A33451.6 
    A12552 
    B13541.2 
    B1288 2.5
    C13443 
    C1412 1.1
    C11111.2 

     

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello guys! Any kind souls?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Please try below steps:

    1. below is my test table

    Table:

    2. create three measure with below dax formula

    Avg for A Score =
    VAR cur_ct =
        SELECTEDVALUE ( 'Table'[Customer] )
    VAR tmp =
        FILTER ( ALL ( 'Table' ), 'Table'[Customer] = cur_ct )
    RETURN
        AVERAGEX ( tmp, [A Score] )
    
    Avg for B Score =
    VAR cur_ct =
        SELECTEDVALUE ( 'Table'[Customer] )
    VAR tmp =
        FILTER ( ALL ( 'Table' ), 'Table'[Customer] = cur_ct )
    RETURN
        AVERAGEX ( tmp, [B Score] )
    
    Avg Score for Total = [Avg for A Score]+[Avg for B Score]

    3. add a slicer with "Table[Customer]" column, add three card visual with above measure, add a table visual with fields

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_ Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    ā€ƒ