Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Buttons that change data labels

Hi all, I got a task from my colleagues and I do have totally no option how to do it.   Basics: We do have a table who contains Sales Documents, division and other measures   Requirement:  - Cr...
  • AllisonKennedy's avatar
    5 years ago

    Anonymous If you want them to be able to choose, you'll need to get a little fancy with measures AND bookmark or parameter slicer. If you want to display both, you only need measures.

     

    Create new measures: 

     

    Absolute Value = COUNT(Table[SalesDocuments])

    Percent = DIVIDE([Absolute Value], CALCULATE([Absolute Value], ALL(Table[Division]))

     

    Create a new table visual, with both measures in it and Division.

     

    Now for the fancy part: 

     

    Option A: Slicer

    Click 'Enter Data'

    Paste this table: 

     

    Show Value As
    Absolute
    Percent

     

    Put Slicer[Show Value As] column in a slicer visual.

     

    Create a new measure: 

     

    Value = SWITCH(SELECTEDVALUE(Slicer[Show Value As])
    , "Absolute", [Absolute Value]
    , "Percent", FORMAT([Percent], "#.00%")
    , [Absolute Value])

     

    Put the [Value] measure in your table and test the slicer.

     

    Option B: Bookmarks

    Duplicate the table. Remove [Percentage] from one table and remove [Absolute Value] from the other table. Hide the Percentage table, create a new bookmark, name it 'Absolute Value'. Click the three dots and untick 'data' and 'current page'. Now unhide percentage table and hide absolute value table. Repeat bookmark creation process, but name it 'Percentage'. 

    Add a button for each bookmark.