Forum Discussion

Brenton's avatar
Brenton
New Member
2 years ago

Using two separate slicers with custom DAX range logic

Copy of full project here.

 

I am trying to explore relationships between Instagram followers and Spotify listeners. I've set up two slicer panes with tiles, and then wrote a DAX measure to create labels and IF statements that returns TRUE based on selections.

It mostly works the way I want, until I do multiple selections for either measure.

 

WORKS

  • Select one instagram slice

  • Select one Spotify slice

  • select one Spotify slice AND one instagram slice

BREAKS

  • Select two instagram slices or two Spotify slices

  • Select one instagram slice and two Spotify slices (ends up displaying same as clicking one instagram slice)

  • Select one Spotify slice and two instagram slices (ends up displaying same as clicking one Spotify slice)

Would anyone be able to take a look at my logic and let me know why I can't multiple selections to sync or offer any advice?

 

TABLE INFORMATION

The main data table contains artist names, and one column for total instagram followers and one for total Spotify followers.

 

Instagram Measure

 

 

 

InstagramPreset Value = 
VAR presetCodeInsta = SELECTEDVALUE('Instagram Panel'[Instagram Followers])
VAR followers = MAX('Research Doc'[Instagram Follower])

VAR instaResult = 
SWITCH(
    presetCodeInsta, 
    "5M+", IF( followers >= 5000000, 1),
    "2M-5M", IF( followers >= 2000000 && followers <= 5000000, 1),
    "1M-2M", IF( followers >= 1000000 && followers <= 2000000, 1),
    "750K-1M", IF( followers >= 750000 && followers <= 1000000, 1),
    "500K-750K", IF( followers >= 500000 && followers <= 750000, 1),
    "400K-500K", IF( followers >= 400000 && followers <= 500000, 1),
    "<400K", IF(followers <= 400000, 1),
    1)
RETURN instaResult

 

 

 

Spotify Measure

 

 

 

Preset Values = 
VAR presetCodeSpotify = SELECTEDVALUE('Spotify Panel'[Spotify Listeners])
VAR listeners = MAX('Research Doc'[spotify])
VAR presetCodeInsta = SELECTEDVALUE('Instagram Panel'[Instagram Followers])
VAR followers = MAX('Research Doc'[Instagram Follower])
VAR spotifyResult = 
SWITCH(
    presetCodeSpotify, 
    "25M+", IF( listeners >= 25000000, 1),
    "15M-25M", IF( listeners >= 15000000 && listeners <= 25000000, 1),
    "10M-15M", IF( listeners >= 10000000 && listeners <= 15000000, 1),
    "7.5M-10M", IF( listeners >= 7500000 && listeners <= 10000000, 1),
    "5M-7.5M", IF( listeners >= 5000000 && listeners <= 7500000, 1),
    "2.5M-5M", IF( listeners >= 2500000 && listeners <= 5000000, 1),
    "1M-2M", IF( listeners >= 1000000 && listeners <= 2000000, 1),
    1)
RETURN spotifyResult

 

 

 

 

1 Reply

  • Brenton ,based on what I got

     

    if there is only one record for each artist's name in the table , then you should create a column not measure.

     

    if not you can create a column and then create bucket on that

     

    sum follower = sumx(filter(Table, [Artist name] = earlier([Artist name]) ), [Instagram follower])