Forum Discussion

Josuep's avatar
Josuep
Frequent Visitor
3 years ago

Add a calculated field in a Matrix

Hi,  in below matrix I have the columns "Fully Matched" and "Unmatched", the numbers are the count (not the sum) of each of these events. They both come from the same field in the data base, the field is a text field.  I need to add a column to show the % of the "Unmatched" from the "Total",  how can I do this?

 

 

3 Replies

  • adudani's avatar
    adudani
    Memorable Member

    hi Josuep

    try this:

    measure=

    var _unmatchedcount = Calculate( Count('Table'[Column]),'Table'[Column]="Unmatched")


    var _total = Calculate( Count('Table'[Column]), All ('Table') )

     

    var _result = divide( _unmatchedcount, _total, "-") 

     

    return

    _result

     

     

    let me know if this resolves the question.

     

    Appreciate a thumbs up if this is helpful.
     

    • Josuep's avatar
      Josuep
      Frequent Visitor

      Hi Aduani,  I tried your suggestion  but got this error: "The COUNT function only accepts reference as an argument",   here is a screen shot:

       

       

      Daily Overview = Table

      Ca matched = Column

       

      hope can help with this

       

      Thanks

       

      • adudani's avatar
        adudani
        Memorable Member

        Hi Josuep ,

        Thanks. I modified the filter condition in my previous response, removing the count in the filter expression. So it's 'Table'[Colum] not wrapped in an aggregation.

         

        Also I suggest you use variables, it is better for readibility and debugging 

        Let me know if this works.thanks