Forum Discussion

c5966's avatar
c5966
Helper I
7 years ago
Solved

Calculated field with matrix

I need some support in calculated field in matrix table. Any help is much appreciated.

 

I have 2 columns 

CLASS_CONF and Change_class (which has 2 seperate values ClassChange and NoClassChange).

 

Original Table:

 

I need to have a calculated column as below.

 

 

Matrix and red column is expected column: 

 

Thank you

c5966

  • c5966's avatar
    c5966
    7 years ago

    Thank you for your help

     

    I understood how to do this, first I need to group my class confidence and then use your divide function.

     

    Accuracy = CALCULATE(divide(sum('table'[NoClassChange]), sum('table'[ClassChange])+sum('table'[NoClassChange])), fILTER(ALL('table'), 'table'[MEDTR_FRONT_VDAC_CLASS_CONF] = EARLIER('table'[MEDTR_FRONT_VDAC_CLASS_CONF])))

8 Replies

  • Nathaniel_C's avatar
    Nathaniel_C
    Community Champion

    Hi c5966 ,

    If I understand that you are looking for a Dax formula, try Accuracy = Divide([No Class Change], [Class Change] + [No Class Change]). For the first line in your matrix, you would have the result below. 

    If this solves your issue, please mark this as the solution. Kudos are nice too!

    Nathaniel

     

    • c5966's avatar
      c5966
      Helper I
      Appreciate your help.
       
      Accuracy = Divide([NoClassChange],[ClassChange]+[NoClassChange])
       
      This DAX formula did not give expected output ,please see below screenshot.
       
      I would really appreciate any help on this topic.
       
      Thank you.
       
       
      • Nathaniel_C's avatar
        Nathaniel_C
        Community Champion

        c5966 

        My table with measure just make sure it is formatted for percentage

        d

         

        If this solves your issue, please mark this as the solution. Kudos are nice too!

        Nathaniel