Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
pieterhkruger
Frequent Visitor

Line graph percentages to sum to 100% by x-axis value

Hi,

 

Consider the following simple example of two possible line graphs based on counts:Line graph.GIF

What I want, however, is a graph with percentages (like the second one), but where the percentages are not in terms the overall total, but in terms of the totals for the x-axis values (i.e. subtotals by date).  In other words, for 01 May 2019, I want to have values 50% (3 / 6) for Group A and 50% (3 / 6) for Group B; for 02 May 2019, I want to have values 75% (6 / 😎 for Group A and 25% (2 / 😎 for Group B;  for 03 May 2019, I want 33% (2/6) and 66% (4/6) respectively.

 

How do I go about to do that?  (I suppose I need to create a measure in DAX, but I am not sure how to construct it).

 

Thanks.

1 REPLY 1
v-yuta-msft
Community Support
Community Support

@pieterhkruger,

 

You can create two measures using DAX below:

Percentage Of Group A = CALCULATE(SUM('Table'[Count of Group]), FILTER(ALLEXCEPT('Table', 'Table'[Date]), 'Table'[Group] = "A")) / CALCULATE(SUM('Table'[Count of Group]), ALLEXCEPT('Table', 'Table'[Date]))

Percentage Of Group B = CALCULATE(SUM('Table'[Count of Group]), FILTER(ALLEXCEPT('Table', 'Table'[Date]), 'Table'[Group] = "B")) / CALCULATE(SUM('Table'[Count of Group]), ALLEXCEPT('Table', 'Table'[Date]))

Capture.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.