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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
PowerAutomater
Helper II
Helper II

How to combine or overlay similar line charts together?

After extensive searching I have looked at many questions looking for something similar but unfortunately still haven't found the solution to achieve the below.

I have 2 simple line charts showing the total amount of sales over time, with the x axis showing the date of purchase and the y axis a count of the products. In the top chart I have filtered it to only show products 1-5 and in the second I have filtered it to only show products 6-10. So essentially 2 copies of the same chart just with different filters applied.

 

I would now like to overlay these two line charts over the top of each (or combine them into one chart) to visually compare how these 2 groups of products are selling over time. I would prefer not to create any new tables.

What is the easiest way to achieve this?

1 ACCEPTED SOLUTION

Hi @PowerAutomater 
If measures based on filters selections , you can create a model like on the attached picture , with 2 products tables : 1. with active relationship
2. with innactive

Ritaf1983_0-1737460809098.png

And use these 2 measures :

Line1 = SUM('lines table'[Value])
Line2 = CALCULATE( SUM('lines table'[Value]),all('prod_table1'),USERELATIONSHIP(prod_table2[Product],'lines table'[Product]))
Result:
Ritaf1983_1-1737460871679.png

The updated pbix is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

7 REPLIES 7
Ritaf1983
Super User
Super User

Hi @PowerAutomater 

 

You can create 2 measures with filters of top / bottom and put them on the same graph.
For example if i want top 5 and bottom 5 customers sales 

:The first measure will be

Top 5 customers sales =
SUMX(
        TOPN(
            5,
            SUMMARIZE(
                    Orders,
                    Orders[Customer ID],
                    "TotalSales", [Sales]
            ),
            [TotalSales], DESC
        ),
        [TotalSales]
)
The second :
Bottom 5 customers sales =
SUMX(
        TOPN(
           5,
            SUMMARIZE(
                    Orders,
                    Orders[Customer ID],
                    "TotalSales", [Sales]
            ),
            [TotalSales], ASC
        ),
        [TotalSales]
)
The graph will look like :
Ritaf1983_0-1737433733470.png

The pbix with the example is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

I have considered using measures but the trouble is that I am hand picking the products in the filters at the moment, as these 2 groups of products are not categorised/distinguished by any other field so I'm not sure how I could make measures that specifically filter these.

Hi again @PowerAutomater 

Please share sample data (excluding sensitive information) in text format, along with your expected result and any relevant logic. For guidance, refer to

How to provide sample data in the Power BI Forum

If possible, upload a simplified .pbix file using this guide:

 How to upload PBI in Community

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi Rita, the data would look similar to this:

Product 11/1/25
Product 22/1/25
Product 13/1/25
Product 33/1/25
Product 45/1/25
Product 26/1/25
Product 17/1/25
Product 18/1/25
Product 49/1/25
Product 29/1/25

 

Line chart 1 would show only products 1 & 3, Line chart 2 would show only products 2 & 4. Does this help?

Hi @PowerAutomater 
If measures based on filters selections , you can create a model like on the attached picture , with 2 products tables : 1. with active relationship
2. with innactive

Ritaf1983_0-1737460809098.png

And use these 2 measures :

Line1 = SUM('lines table'[Value])
Line2 = CALCULATE( SUM('lines table'[Value]),all('prod_table1'),USERELATIONSHIP(prod_table2[Product],'lines table'[Product]))
Result:
Ritaf1983_1-1737460871679.png

The updated pbix is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Is there any way to achieve this without creating new tables at all?

I in doubt.

You need in someway manipulate filter context of your selections, so you you need these dims tables. 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.