Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Change value in column based on slicer

Hello, I have this issue where I make another column from past column, but for one type of values I want to change based on what is selected on Slicer.

Logic should be if the "Type." column value is Intercompany and in slicer is selected Company A, then TypeX value should be "Company A" instead of "Test" currently. Same for Company B.

 

Current sniped of code to show the logic:

TypeX = IF('2022'[Type.]="Intercompany ACMI",
"Test"

,'2022'[Type.])
 
Any ideas of workaround for this problem? Thanks.
  • You can create 3 visuals over each other, hide 2 of them and create a bookmark. You should select all 3 of them while creating the bookmark from selection pane. After that, please select "Selected Visuals" and untick "Data". You should create a bookmark for each visual and assign it to a button.

     

    Hope it helps ğŸ™‚

     

     

     

7 Replies

  • Hi Lukas,

     

    I believe it's not possible to change a column dynamically. You can create a measure instead. Can you try below one and check it in a table visual.

     
    TypeX = IF('2022'[Type.]="Intercompany ACMI",
    SELECTEDVALUE(Company)

     

    ,'2022'[Type.])

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      It seems to show values as (Blank). 

       

      I wonder what could be the the solution then. Create different columns, one for company A, one for company B and one for both. And then change visual based on slicer, but slicer would just take different column into the visual then. What you do think about this? Is it possible this way?

  • Hi Lukas,

     

    Can you try something like this one, it seems to work.

     

    Measure =

    SWITCH
    (
    TRUE(),
    SELECTEDVALUE('Table (2)'[Type]) = "I",
    SELECTEDVALUE('Table (3)'[Column1],"Test"),
    SELECTEDVALUE('Table (2)'[Type],"Test")
    )

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello, 

       

      How do you derive to aquire "Column1" ?

      EDIT: I figured that out and managed to replicate what you have showed me and indeed it works, quite a cool feature. But anyway I can then display this data with measure in charts? It seems I get an error when trying to use measure in chart.

      • coskuersanli's avatar
        coskuersanli
        Icon for Resolver III rankResolver III

        Hi Lukas,

         

        If you need to use it as a column in your graph, we may need to try something different. As you said earlier, we can create different columns for all possibilities and create bookmarks for company filter.