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
orensteinb
Regular Visitor

Stacked Line Chart - not stacking up

Hello, I am relatively experienced with power BI but have recently been tasked with creating a visual representation of a company's revenue over time, by entity. As you can see from the examples below, the comany has a lot of different entities - this is not the issue. I'm trying to make all of the lines in the chart stack up - the only problem is, some entities will have no recorded revenue at all in a given period (like the data set doesn't show zero revenue, it doesn't have a value at all in that period). Additionally, some entities will have a negative revenue in a given period. What I would like to see is that the stacked lines all stack up each period, but I would like to see none of the lines cross each other. That way it is super clear that in any given period, which entities have which amount of revenue. I know that using a stacked bar chart accomplishes this very easily, but was curious if there is a way to make it work for line charts. 

I have included two screenshots of the charts - after doing some searching online someone suggested to switch the x-axis type to categorical instead of continuous but they both showed the lines crossing each other.

X-axis as continuous: 

orensteinb_0-1724167978390.png



x-axis as categorical:

orensteinb_1-1724167992966.png

 



Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @orensteinb .

Regarding the issue you raised, my solution is as follows:

First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1724221055485.png
For example, I need the value of column to stay above column2 and the two lines do not intersect:
1.I've created a measure substitution visualization like this:

Measure = IF(SUM('Table'[Column])>=SUM('Table'[Column 2]),SUM('Table'[Column]),0)
Measure 2 = IF(SUM('Table'[Column 2])<SUM('Table'[Column]),SUM('Table'[Column 2]),0)

2.Then modify the filter:

vlinyulumsft_1-1724221121027.png

3.Here's the original visualization:

vlinyulumsft_2-1724221121032.png

Here's a visualization that uses a measure judgment:

vlinyulumsft_3-1724221136173.png

If your needs involve multiple judgments, you can also choose the switch() function, and here is the documentation:
SWITCH function (DAX) - DAX | Microsoft Learn
 

Of course, you can also use PowerQuery to modify the data itself.


Best Regards,

Leroy Lu

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


 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi, @orensteinb .

Regarding the issue you raised, my solution is as follows:

First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1724221055485.png
For example, I need the value of column to stay above column2 and the two lines do not intersect:
1.I've created a measure substitution visualization like this:

Measure = IF(SUM('Table'[Column])>=SUM('Table'[Column 2]),SUM('Table'[Column]),0)
Measure 2 = IF(SUM('Table'[Column 2])<SUM('Table'[Column]),SUM('Table'[Column 2]),0)

2.Then modify the filter:

vlinyulumsft_1-1724221121027.png

3.Here's the original visualization:

vlinyulumsft_2-1724221121032.png

Here's a visualization that uses a measure judgment:

vlinyulumsft_3-1724221136173.png

If your needs involve multiple judgments, you can also choose the switch() function, and here is the documentation:
SWITCH function (DAX) - DAX | Microsoft Learn
 

Of course, you can also use PowerQuery to modify the data itself.


Best Regards,

Leroy Lu

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


 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.