Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Scatter chart dynamic X and Y axis.

Hi all,
I am trying to plot scatter chart with below data.

HomeNumber

Membernumber

DeviceType

Viewed Devices

Claimed Devices

Viewed device_Total_Level

Claimed_device_Total_Level

1700148

1

PC

1

1

2

2

1700148

1

Tablet

1

1

2

2

1700148

2

PC

2

1

4

3

1700148

2

Tablet

2

1

4

3

1700149

1

PC

1

2

1

2

100149

4

PC

1

2

1

2


We have one filter on graph device type.
If user choose any value from the filter it will select x axis Claimed Devices and Y axis Viewed Devices
else by default it is showing the data on x axis claimed devices_total_level and Y axis Viewed devices total level.

And size on the graph is unique count of home and member number.

I tried to created measure to achieve this scenario.

Here is my measure.
Claimed_Device_Total_Level. = IF(ISFILTERED(Sheet1[DeviceType]),

SELECTEDVALUE(Sheet1[Claimed Devices]),SELECTEDVALUE(Sheet1[Claimed_device_Total_Level]))

Viewed_Device_Total_Level. =

IF(

    ISFILTERED(Sheet1[DeviceType]),

    SELECTEDVALUE(Sheet1[Viewed Devices]),SELECTEDVALUE(Sheet1[Viewed device_Total_Level]))


Need help to resolve this scenario.

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Use Enter data to create a table.

    2. Create measure.

    Measure =
    VAR _select=SELECTEDVALUE('Table'[DeviceType])
    return
    SWITCH(
        TRUE(),
        MAX('xy'[X])="Claimed Devices",
        CALCULATE(SUM('Table'[Claimed Devices]),FILTER(ALL('Table'),
        'Table'[DeviceType]=_select)),
        MAX('xy'[X])="Viewed Devices",
        CALCULATE(SUM('Table'[Viewed Devices]),ALL('Table')
        ),
        MAX('xy'[X])="Claimed devices_total_level",
        CALCULATE(SUM('Table'[Claimed_device_Total_Level]),FILTER(ALL('Table'),
        'Table'[DeviceType]=_select)),
        MAX('xy'[X])="Viewed devices total level",
        CALCULATE(SUM('Table'[Viewed device_Total_Level]),ALL('Table')
       ))
    Flag =
    SWITCH(
        TRUE(),
       HASONEFILTER('Table'[DeviceType])&&OR( MAX('xy'[X])="Claimed Devices",MAX('xy'[Y])="Claimed devices_total_level"),1,
       HASONEFILTER('Table'[DeviceType])=FALSE()&&OR( MAX('xy'[X])="Viewed Devices",MAX('xy'[Y])="Viewed devices total level"),1,
        0)

    3. Place in the following form.

    4. Place [Flag]in Filters, set is=1, apply filter.

    5. Result:

    When the slicer is selected, it displays::

    When no slicer is selected, it displays:

    If you need pbix, please click here.

     

    Best Regards,

    Liu Yang

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

2 Replies

  • Anonymous , to check isfiltered, use a code

    calculate(ISFILTERED(Sheet1[DeviceType]), allselected())

     

    This will make sure it does not consider visual row context filter, it this is used in visual

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

    Here are the steps you can follow:

    1. Use Enter data to create a table.

    2. Create measure.

    Measure =
    VAR _select=SELECTEDVALUE('Table'[DeviceType])
    return
    SWITCH(
        TRUE(),
        MAX('xy'[X])="Claimed Devices",
        CALCULATE(SUM('Table'[Claimed Devices]),FILTER(ALL('Table'),
        'Table'[DeviceType]=_select)),
        MAX('xy'[X])="Viewed Devices",
        CALCULATE(SUM('Table'[Viewed Devices]),ALL('Table')
        ),
        MAX('xy'[X])="Claimed devices_total_level",
        CALCULATE(SUM('Table'[Claimed_device_Total_Level]),FILTER(ALL('Table'),
        'Table'[DeviceType]=_select)),
        MAX('xy'[X])="Viewed devices total level",
        CALCULATE(SUM('Table'[Viewed device_Total_Level]),ALL('Table')
       ))
    Flag =
    SWITCH(
        TRUE(),
       HASONEFILTER('Table'[DeviceType])&&OR( MAX('xy'[X])="Claimed Devices",MAX('xy'[Y])="Claimed devices_total_level"),1,
       HASONEFILTER('Table'[DeviceType])=FALSE()&&OR( MAX('xy'[X])="Viewed Devices",MAX('xy'[Y])="Viewed devices total level"),1,
        0)

    3. Place in the following form.

    4. Place [Flag]in Filters, set is=1, apply filter.

    5. Result:

    When the slicer is selected, it displays::

    When no slicer is selected, it displays:

    If you need pbix, please click here.

     

    Best Regards,

    Liu Yang

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