Forum Discussion

jayasurya_prud's avatar
jayasurya_prud
Advocate III
4 years ago
Solved

Calculation in table

I have a table with me which has a column of category names. I need to get the count of every category and the percentage of the category with total in a visual table/matrix. For example, like this

ProductsnosPercent
A318.75%
B425.00%
C318.75%
D318.75%
E318.75%
Total16100.00%


Please guide me with a solution

  • PaulDBrown's avatar
    PaulDBrown
    4 years ago

    Sorry, I thought "nos" was an actual field. 
    Try:

    Count Products = 
    COUNT('Table'[PRODUCTS])
    % Over totals =
    DIVIDE (
        [Count Products],
        CALCULATE ( [Count Products], ALL ( 'Table'[PRODUCTS] ) )
    )
    

     

6 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    Try

    % over total =
    DIVIDE (
        SUM ( Table[nos] ),
        CALCULATE ( SUM ( Table[nos] ), ALL ( Table[Products] ) )
    )
    
    • jayasurya_prud's avatar
      jayasurya_prud
      Advocate III

      Hi, Why should I need to do sum? I need the count value. 

      the nos column is the count of every category.

       

       

      lets say that my column is like this 

       

      PRODUCTS
      A
      A
      A
      B
      B
      B
      B
      C
      C
      C
      D
      D
      D
      E
      E
      E

       

      from this, I wan to get the count of every category and also the percentage.  like this in table / matrix visual

       

      ProductsnosPercent
      A318.75%
      B425.00%
      C318.75%
      D318.75%
      E318.75%
      Total16100.00%
      • PaulDBrown's avatar
        PaulDBrown
        Community Champion

        Sorry, I thought "nos" was an actual field. 
        Try:

        Count Products = 
        COUNT('Table'[PRODUCTS])
        % Over totals =
        DIVIDE (
            [Count Products],
            CALCULATE ( [Count Products], ALL ( 'Table'[PRODUCTS] ) )
        )