Forum Discussion
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]
)
)
) * 100Alternative 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) * 100Implementation Steps:
- Import your Excel data into Power BI
- Create the DAX measures above in your model
- Build Line Chart:
- Axis: Actual Month
- Legend: Element group name
- Values: % of Column Total measure
- 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
- hb0135Helper III
i ahve this type data set in excel
Element group name value Actual Month A 1186295.9 Jan A 17076 Jan A 1186295.9 Feb A 17076 Feb A 863330.9 Feb A 88312.5 Feb A 2294931.3 Feb A 234754.9 Feb A 323502.1 Feb A 1104624.4 Feb A 112995.1 Feb A 679168.8 Feb A 69474.1 Feb A 1320367 Feb A 336330.9 Feb A 28616.6 Feb A 176663 Feb A 27023.6 Feb A 443139.3 Feb A 44569.5 Feb A 404469.1 Feb A 59950.4 Feb A 22096.3 Feb A 31849.7 Feb A -89718 Feb - jaineshpMemorable 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]
)
)
) * 100Alternative 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) * 100Implementation Steps:
- Import your Excel data into Power BI
- Create the DAX measures above in your model
- Build Line Chart:
- Axis: Actual Month
- Legend: Element group name
- Values: % of Column Total measure
- 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