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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Use dax to create a dynamic X and Y axis

Hi, I am trying to create a dax measure that would change the x and y axis on a scatter graph tooltip based off of a selection made by the user.

 

Thanks in advance!

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous ,

 

We couldn't add measure into X Axis or Y Axis field in scatter visual. Here I suggest you to create a selection table and then create a measure to filter X Axis and Y Axis.

Here I create a selection with two selections. Selection1 will range X and Y from 2 to 5. Selection2 will range X and Y from 3 to 6. 

1.png

Measure:

Measure = 
IF(
ISFILTERED(Selection[Selection]), 
SWITCH(
MAX(Selection[Selection]),
"Selection1",
IF(SUM('Table'[X])<=5&&SUM('Table'[X])>=2&&SUM('Table'[Y])<=5&&SUM('Table'[Y])>=2,1,0),
"Selection2",
IF(SUM('Table'[X])<=6&&SUM('Table'[X])>=3&&SUM('Table'[Y])<=6&&SUM('Table'[Y])>=3,1,0)),
1
)

Create a Scatter visual , then add this measure into visual level filter and set it to show items when value =1. Result is as below.

By Default:

1.png

Selection1:

2.png

Selection2:

3.png

Best Regards,
Rico Zhou

 

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

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous ,

 

We couldn't add measure into X Axis or Y Axis field in scatter visual. Here I suggest you to create a selection table and then create a measure to filter X Axis and Y Axis.

Here I create a selection with two selections. Selection1 will range X and Y from 2 to 5. Selection2 will range X and Y from 3 to 6. 

1.png

Measure:

Measure = 
IF(
ISFILTERED(Selection[Selection]), 
SWITCH(
MAX(Selection[Selection]),
"Selection1",
IF(SUM('Table'[X])<=5&&SUM('Table'[X])>=2&&SUM('Table'[Y])<=5&&SUM('Table'[Y])>=2,1,0),
"Selection2",
IF(SUM('Table'[X])<=6&&SUM('Table'[X])>=3&&SUM('Table'[Y])<=6&&SUM('Table'[Y])>=3,1,0)),
1
)

Create a Scatter visual , then add this measure into visual level filter and set it to show items when value =1. Result is as below.

By Default:

1.png

Selection1:

2.png

Selection2:

3.png

Best Regards,
Rico Zhou

 

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

Anonymous
Not applicable

So my plan was to use the scattergraph as a tooltip on a heatmap and to do that I wanted to create a measure for both X and Y fields. Is this not possible yet in powerBI? I know I can do it in python, but powerBI does not like python tooltips

Hi @Anonymous ,

 

I saw you want to use scattergraph as a tooltip on another visual. Here I suggest you to try report page tooltip function in Power BI. 

For reference: Create tooltips based on report pages in Power BI Desktop

Then create a filter measure to filter this scatter visual as above.

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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