Forum Discussion
Request to Implement XY Plot with Dynamic Axis Filters
- 1 year ago
Hi ribisht17 ,
Sorry for the late response.
Please find the below snap and attached PBIX file.
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 ,
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
- ribisht171 year agoSuper User
Can you share the PBIX file ?
- v-dineshya1 year agoCommunity Support
Hi ribisht17 ,
Sorry for the late response.
Please find the below snap and attached PBIX file.
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
- v-dineshya1 year agoCommunity Support
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- v-dineshya1 year agoCommunity Support
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- v-dineshya1 year agoCommunity Support
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