Forum Discussion

hb0135's avatar
hb0135
Helper III
1 year ago
Solved

Need Help to get the % of Column total In Line Graph

Hello,
I have created Line Graph by Dax Function for getting the % of Column total but in this what is happening i am getting % of Grand total in table & Matrix it is there but for line graph the direst Function is not there.
So how can we get the % of Column total in line Graph
In table it showing the % Coumn total like below

 

i tried but i am getting this i.e % Grand Total

Regards
Atharva

  • Hey hb0135,

    Thanks for sharing the data!

    Based on your Excel dataset, you have:

    • Element group name: Category identifier (A)
    • Value: Numeric values for calculations
    • Actual Month: Time dimension (Jan, Feb, etc.)

    DAX Solution for % of Column Total in Line Graph:

    Step 1: Create Base Measure (if not existing)

     

    Total Value = SUM('YourTable'[value])

     

    Step 2: Create % of Column Total Measure

     

    % of Column Total =
    DIVIDE(
    [Total Value],
    CALCULATE(
    [Total Value],
    ALLEXCEPT(
    'YourTable',
    'YourTable'[Actual Month]
    )
    )
    ) * 100

     

    Alternative Formula:

     

    Column Percentage =
    VAR CurrentValue = [Total Value]
    VAR MonthTotal =
    CALCULATE(
    [Total Value],
    REMOVEFILTERS('YourTable'[Element group name]),
    VALUES('YourTable'[Actual Month])
    )
    RETURN
    DIVIDE(CurrentValue, MonthTotal, 0) * 100

     

     

    Implementation Steps:

    1. Import your Excel data into Power BI
    2. Create the DAX measures above in your model
    3. Build Line Chart:
      • Axis: Actual Month
      • Legend: Element group name
      • Values: % of Column Total measure
    4. Format the visual:
      • Set Y-axis to percentage format
      • Enable data labels if needed

    Expected Result:

    • Each month's line values will sum to 100%
    • Shows proportion of each element within that specific month
    • Matches the matrix % of Column Total behavior you showed earlier

    Key Notes:

    • Replace 'YourTable' with your actual table name
    • Ensure month field is properly formatted as date/text
    • The measure calculates percentage within each month context
    • Values will represent each element's share of the monthly total

    This solution will give you the column-wise percentage calculation in your line graph, similar to what you're seeing in the matrix visualization.

     

    Fixed? ✓ Mark it • Share it • Help others!


    Best Regards,
    Jainesh Poojara | Power BI Developer

4 Replies

  • i ahve this type data set in excel

    Element group namevalueActual Month
    A1186295.9Jan
    A17076Jan
    A1186295.9Feb
    A17076Feb
    A863330.9Feb
    A88312.5Feb
    A2294931.3Feb
    A234754.9Feb
    A323502.1Feb
    A1104624.4Feb
    A112995.1Feb
    A679168.8Feb
    A69474.1Feb
    A1320367Feb
    A336330.9Feb
    A28616.6Feb
    A176663Feb
    A27023.6Feb
    A443139.3Feb
    A44569.5Feb
    A404469.1Feb
    A59950.4Feb
    A22096.3Feb
    A31849.7Feb
    A-89718Feb
  • jaineshp's avatar
    jaineshp
    Memorable Member

    Hey hb0135,

    Thanks for sharing the data!

    Based on your Excel dataset, you have:

    • Element group name: Category identifier (A)
    • Value: Numeric values for calculations
    • Actual Month: Time dimension (Jan, Feb, etc.)

    DAX Solution for % of Column Total in Line Graph:

    Step 1: Create Base Measure (if not existing)

     

    Total Value = SUM('YourTable'[value])

     

    Step 2: Create % of Column Total Measure

     

    % of Column Total =
    DIVIDE(
    [Total Value],
    CALCULATE(
    [Total Value],
    ALLEXCEPT(
    'YourTable',
    'YourTable'[Actual Month]
    )
    )
    ) * 100

     

    Alternative Formula:

     

    Column Percentage =
    VAR CurrentValue = [Total Value]
    VAR MonthTotal =
    CALCULATE(
    [Total Value],
    REMOVEFILTERS('YourTable'[Element group name]),
    VALUES('YourTable'[Actual Month])
    )
    RETURN
    DIVIDE(CurrentValue, MonthTotal, 0) * 100

     

     

    Implementation Steps:

    1. Import your Excel data into Power BI
    2. Create the DAX measures above in your model
    3. Build Line Chart:
      • Axis: Actual Month
      • Legend: Element group name
      • Values: % of Column Total measure
    4. Format the visual:
      • Set Y-axis to percentage format
      • Enable data labels if needed

    Expected Result:

    • Each month's line values will sum to 100%
    • Shows proportion of each element within that specific month
    • Matches the matrix % of Column Total behavior you showed earlier

    Key Notes:

    • Replace 'YourTable' with your actual table name
    • Ensure month field is properly formatted as date/text
    • The measure calculates percentage within each month context
    • Values will represent each element's share of the monthly total

    This solution will give you the column-wise percentage calculation in your line graph, similar to what you're seeing in the matrix visualization.

     

    Fixed? ✓ Mark it • Share it • Help others!


    Best Regards,
    Jainesh Poojara | Power BI Developer

    • hb0135's avatar
      hb0135
      Helper III

      Hello Jaineshp,
      It worked,Thanks for the help.
      Regards
      Atharva

      • jaineshp's avatar
        jaineshp
        Memorable Member

        Hey hb0135,

        Thank you for the kind recognition - always happy to contribute to our community's success!

        Best Regards,
        Jainesh Poojara | Power BI Developer