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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
lushd
Frequent Visitor

Multi variable scatter plot

Hi Community,

 

I have a dataset of shipping voyages with columns for Date, Port, Shipping company, loading time, discharge time, etc. 
One useful visual is a scatterplot with loading time and discharge time on the X and Y axis respectively, where each dot represents a single port. Power BI automatically averages the load/discharge time for each visit to a particular port to correctly place the dot, and the graph works perfectly with no issues. With this the end user can easily see which ports are the most and least efficient. 

 

I have a second graph which is identical in every way including scale, but each dot represents a shipping company rather than a port. This also works perfectally with no issues. 

 

What I want to do is combine these into a single chart where each port dot shows up as blue, and each company dot is red. I see these kinds of graphs all the time (example from 30 second google search included below), but it appears to be impossible on Power Bi. In each case, the category ('port', 'company') shows up in the 'details' field on the visualizations pane. I am able to drag the second catagory in, but rather than displaying all the data at once, this creates a two level graph where I can toggle between the two- which is not what I want. 

 

Given how often I see these kinds of graphs, I just can't imagine it's really not possible. What am I missing, or is there another visual I can download that allows this? 


Thanks so much in advance.

scatter-plot-options-2.png

(Example of what I'm trying to do)

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @lushd ,

 

Please try the following steps:

 

1. Createa a new table with Legend type (Port and Company) for slicer.

2. For dynamic Y-axis:

Measure = 
SWITCH(MAX('ForSlicer'[Legend]),
"Port",CALCULATE(MAX('Table'[discharge time]),FILTER('Table','Table'[Port]=MAX('Table'[Port]))) ,
"Company", CALCULATE(MAX('Table'[discharge time]),FILTER('Table','Table'[Company]=MAX('Table'[Company]))))

3. Create a rank measure for conditional formatting:

For conitional formatting = 
SWITCH(MAX('ForSlicer'[Legend]),
"Port",RANKX(ALL('Table'), CALCULATE ( MAX ( ( 'Table'[Port]) ) ),,ASC,Dense) , 
"Company", RANKX(ALL('Table'), CALCULATE ( MAX ( ( 'Table'[Company]) ) ),,ASC,Dense))

conditional.PNG

4. Add Port and Company to tooltips field.

tooltips.gif

Or unpivot the table.

https://community.powerbi.com/t5/Desktop/Custom-Visualisation-for-multiple-legends-and-values/td-p/6...

 

Best Regards,
Eyelyn Qin
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

2 REPLIES 2
Anonymous
Not applicable

Hi @lushd ,

 

Please try the following steps:

 

1. Createa a new table with Legend type (Port and Company) for slicer.

2. For dynamic Y-axis:

Measure = 
SWITCH(MAX('ForSlicer'[Legend]),
"Port",CALCULATE(MAX('Table'[discharge time]),FILTER('Table','Table'[Port]=MAX('Table'[Port]))) ,
"Company", CALCULATE(MAX('Table'[discharge time]),FILTER('Table','Table'[Company]=MAX('Table'[Company]))))

3. Create a rank measure for conditional formatting:

For conitional formatting = 
SWITCH(MAX('ForSlicer'[Legend]),
"Port",RANKX(ALL('Table'), CALCULATE ( MAX ( ( 'Table'[Port]) ) ),,ASC,Dense) , 
"Company", RANKX(ALL('Table'), CALCULATE ( MAX ( ( 'Table'[Company]) ) ),,ASC,Dense))

conditional.PNG

4. Add Port and Company to tooltips field.

tooltips.gif

Or unpivot the table.

https://community.powerbi.com/t5/Desktop/Custom-Visualisation-for-multiple-legends-and-values/td-p/6...

 

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

amitchandak
Super User
Super User

@lushd , if category and port are two different columns you can have one of them in legend or other on Details.

 

If you want these as legends, You need to unpivot the data

https://radacad.com/pivot-and-unpivot-with-power-bi

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors