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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
SSSBI
Kudo Collector
Kudo Collector

Request to Implement XY Plot with Dynamic Axis Filters

 

XY Plot Requirement

I need to build an XY plot and I have filters for both X-name and Y-name, where the values are the same.

Expectation:

  • When the X-name filter is applied, the X-axis should automatically arrange values from minimum to maximum.
  • Similarly, when the Y-name filter is applied, the Y-axis should also auto-arrange from minimum to maximum.

Data Columns: name, value

Conditions:

  • The X-name filter should be single-select.
  • The Y-name filter should be multi-select.
1 ACCEPTED SOLUTION

Hi @ribisht17 ,

Sorry for the late response.

Please find the below snap and attached PBIX file.

vdineshya_0-1748259488395.png

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

View solution in original post

7 REPLIES 7
v-dineshya
Community Support
Community Support

Hi @SSSBI ,

Thank you for reaching out to the Microsoft Community Forum.

 

Please follow below steps.

1. Create Parameters / Slicers:

X-name Slicer: Create a slicer visual. Use the name column. Set single-select ON.

Y-name Slicer: Create another slicer visual. Use the name column. Set multi-select ON.

2. Create Supporting Measures / Tables:

a. Create a Filtered Table for X-Axis

X_Values =
VAR SelectedX = SELECTEDVALUE('Table'[name])
RETURN
FILTER(
'Table',
'Table'[name] = SelectedX
)

b. Create a Filtered Table for Y-Axis

Y_Values =
VAR SelectedY = VALUES('Table'[name])
RETURN
FILTER(
'Table',
'Table'[name] IN SelectedY
)

3. Build a Combined Table for XY Plot: To pair values by index or row number, add row numbers first.

a. Add Indexes per Name: Use Power Query to group by name, then add an index per group.

b. Create a Combined Table:

XY_Combined =
VAR XName = SELECTEDVALUE('Table'[name])
VAR XTable =
ADDCOLUMNS(
FILTER('Table', 'Table'[name] = XName),
"Index", RANKX(FILTER('Table', 'Table'[name] = XName), 'Table'[value], , ASC)
)

VAR YNames = VALUES('Table'[name])
VAR YTable =
ADDCOLUMNS(
FILTER('Table', 'Table'[name] IN YNames),
"Index", RANKX(FILTER('Table', 'Table'[name] IN YNames), 'Table'[value], , ASC)
)

RETURN
SELECTCOLUMNS(
NATURALINNERJOIN(XTable, YTable),
"X", XTable[value],
"Y", YTable[value]
)

4. Create the XY Scatter Plot
Use the final XY_Combined table.

X-axis → X & Y-axis → Y. This will plot filtered values based on slicer selections. Axis will auto-scale due to default Power BI behavior (based on data range).

 

If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

Thank you

Hi @SSSBI ,

If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

Thank you

Hi @SSSBI ,

If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

Thank you

Hi @SSSBI ,

If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

Thank you

Can you share the PBIX file ?

Hi @ribisht17 ,

Sorry for the late response.

Please find the below snap and attached PBIX file.

vdineshya_0-1748259488395.png

If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.

Thank you

ribisht17
Community Champion
Community Champion

Hello @SSSBI 

 

X_Rank = RANKX(ALLSELECTED('Table'), 'Table'[Value], , ASC, DENSE)

 

Y_Rank = RANKX(ALLSELECTED('Table'), 'Table'[Value], , ASC, DENSE)

 

In this video you can find 3 ways > 3+ approaches for Dynamic Axis in Power BI - YouTube

 

You can see a similar Solution here > Single scatter chart w/ dynamic XY axis - Microsoft Fabric Community

 

Regards,

Ritesh

Community Champion

Please mark the answer if helpful so that it can help others

Dance-Sing with Data Analytics

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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