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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Bnjmnrod
Regular Visitor

Line chart visual with two lines based on two slicers

Hello! 

(I am quite new to Power BI)

I need to create a line chart to compare the revenue of customers. I've divided the report page in two areas, each for a customer. So on the left I have a slicers for customer 1 and on the right for customer 2. I want to combine these selections in one line chart with 2 lines. 1 line for each selected customer. 

Is there anyone that maybe has an solution for this?

 

thank you!

1 ACCEPTED SOLUTION

Hi, 
Please see this tutorial...
If I understood you correctly,
this is exactly your scenario:

https://www.youtube.com/watch?v=O0VsTLDTjss

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

View solution in original post

11 REPLIES 11
Ritaf1983
Super User
Super User

Hi @Bnjmnrod 

The desired result could be achieved in one graph by:
Time points on the X axis
Revenue on the Y
A customer name on the legend

As you can see in the attached pic

Ritaf1983_0-1685089633815.png

Link to sample file 

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

 

Hi, 

 

the customer list is very large so this is showing a lot of lines in the graph.. I also want to have the slicer (that is also affecting other visuals) to insert a line in the chart

Hi,
It's ok you will see only the customers you have selected on the slicer

Ritaf1983_0-1685090513969.png

and slicer affects all visuals on the page

Hi, 

aha I see, it works now but only with one slicer. When I add another slicer and select another Customer the line chart show all white. Is it possible to have 2 seperate slicers (they dont interact with eachother but only with the line chart) to have the same outcome? If not I will use your solution but preferable is 2 slicers. Thank you!

You can use 2 slicers, but what is the reason to do it if the user can choose all customers he needs from one slicer and show it on one graph? And what if he will need to compare between 3 and not 2 customers?

Hi, 

I think I did not explain enough:

on the page have 2 areas. One for the selected customer(s). So I can create a selection of customers on the left to compare them with a selection I made on the right. Untill now I had 2 seperate line charts to show the data over the months. But I thought it would be much more usable to have the left selection showing as line 1 and the right selection showing as line 2 in the same chart. I hope this explains enough!

Hi, 
Please see this tutorial...
If I understood you correctly,
this is exactly your scenario:

https://www.youtube.com/watch?v=O0VsTLDTjss

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

Hi Friends,

 

I have a similar challenge, where I need to populate data from two different slicers in a single double-line chart or clustered column chart. The biggest challenge that I am facing is I cant create any new tables in the dataset. Is there a way of handling this situation without creating any new/ duplicate tables for the two slicers?

Thank you! It works

I'm glad I could help 🙂

pratyashasamal
Super User
Super User

Hi @Bnjmnrod ,

In each line measure you have to check if that value is selected or not

 

example

 

ABC new = If("ABC" in allselected(Slicer[Slicer]) , [ABC], blank())

 

DEF new = If("DEF " in allselected(Slicer[Slicer]) , [DEF ], blank())

Thanks ,
Pratyasha Samal
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors