Forum Discussion
Buttons that change data labels
- 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.
Anonymous The same slicer can update the values among all measures, but you'll need to create a measure for each calculation, so if 5 metrics, 10 measures.
I tried your method and stumbled over a few questions, which I'll ad in Italic to your instructions:
"
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. Do you mean I should create a visuals that is a table and put both measures in or do you mean I should create a new table in the "Data section", name it "visual" and out both measures in it?
Now for the fancy part:
Option A: Slicer
Click 'Enter Data'
Paste this table:
| Show Value As |
| Absolute |
| Percentage |
Put Slicer[Show Value As] column in a slicer visual. I think that means I should name the Table Slicer[Show Value As]? If I don't and enter the dax formula below it tells me that it "can't find table Slicer [Show Value As]".
Create a new measure:
Value = SWITCH(Slicer[Show Value As]
, "Absolute", [Absolute Value]
, "Percent", [Percent])
like said, if the Name of Slicer table is just "Slicer" and the one of the first is "Show Value As", formula doesn't work, it seems to expect a table as expression.
Put the [Value] measure in your table and test the slicer Which table? The visual that is a table or a data table? If yes, which one?"
Sorry for the partly stupid and very specific questions, but I was a little confused by the meanings of the word table and I must have taken a wrong turn somewhere cause it didn't work out in the end...
Help would be much appreciated cause I thiink your method is probably the best one for my usecase