Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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!
  • Anonymous's avatar
    Anonymous
    4 years ago

    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. 

    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:

    Selection1:

    Selection2:

    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.