Forum Discussion

dofrancis3's avatar
dofrancis3
Icon for Resolver I rankResolver I
1 year ago
Solved

Calculate percentage

Dear Team;

I would like to request your support.

How can i calculate the percentage? (Dax). In case I have the tables (1srt one OR second one) below :

 

Thank you

  • dofrancis3 , Update measure as 

     

    Percentage of Total1 =
    VAR TotalSum = [Total1]  -- Assuming [Total1] is your measure
    VAR GrandTotal = CALCULATE([Total1], ALL('Table'))
    RETURN
    DIVIDE(TotalSum, GrandTotal) * 100
     
    Attached updated PBIX considering Total as measure

6 Replies

  • dofrancis3 

    Assuming you want to calculate the percentage of cases based on Gender in the first table:

    Create measures:

    Total Cases = SUM('YourTableName'[Case]) 
    Total Cases Female = 
    CALCULATE (
    [Total Cases],
    'YourTableName'[Gender] = "F"
    )
    Total Cases Male = 
    CALCULATE (
    [Total Cases],
    'YourTableName'[Gender] = "M"
    )
    Percentage Female = 
    DIVIDE (
    [Total Cases Female],
    [Total Cases],
    0
    )
    Percentage Male = 
    DIVIDE (
    [Total Cases Male],
    [Total Cases],
    0
    )

    💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
    Cheers,
    Kedar
    Connect on LinkedIn

     

    • dofrancis3's avatar
      dofrancis3
      Icon for Resolver I rankResolver I

      Dear Kedar_Pande Thank you for your replay but i would like to calculate only the percentage of total cases

       

      • bhanu_gautam's avatar
        bhanu_gautam
        Icon for Super User rankSuper User

        dofrancis3 , Try creating a measure like

         

        Percentage of Total =
        DIVIDE(
            SUM('Table'[Total]),
            CALCULATE(SUM('Table'[Total]), ALL('Table'))
        ) * 100
         
        PBIX file attached with solution