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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. 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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors