Forum Discussion

mike_asplin's avatar
mike_asplin
Helper V
6 months ago
Solved

Button formatting for On Press doesnt stick

Hi. Have created a button and gone into button formatting and set the On press ofmrat to red on white and default as white on blue.    If I Ctrl click on the button it flashes red on white, changes...
  • dk_dk's avatar
    6 months ago

    Hi mike_asplin 

    There is a couple ways you can approach this.

    First option:
    Instead of having 2 separate visuals, have a single visual and have your slicer toggle the currency. You could do this with calculation groups (see this article) but an easy way would be to create a third measure (I assume you have one measure that shows your data in GBP and one in local currency) which would look something like this:

    Slicer Reactive measure calc = 
    
    IF(SELECTEDVALUE(<YOUR SLICER HERE>)=<CONDITION>,<GBP Measure>, <Local curr Measure>)

    In the below example:

    Slicer Reactive measure calc = 
    
    IF(SELECTEDVALUE('Table'[Currency])="EUR","5 eur", "4 GBP")

    and the visual updates without using any bookmarks.


    Second option:

    Instead of formatting the buttons, you can use blank buttons to drive the switch between the two states (and showing / hiding the respective visuals) and instead create 4 textbox visuals which you can format as you wish (one visual for each "selection" and one for each state - so you would have :

    "GBP selected" - red on white, "GBP unselected" - white on blue, and a blank button with a bookmark action. All 3 of these on top of eachother. And the same for the Local currency. And you just need to set up the bookmarks so it also controls the visibility of the correct textboxes. For instance when you select the GBP button, it would make "GBP Selected" and "Local Currency unselected" visible, (along with your GBP based visual(s) in the report, while hiding the other textboxes. and vice versa if you select the Local currency button.


    Hope this helps! Let me know if you have any questions!