One of the features across the various visualisation programmes that is exclusive to Tableau are its parameters, and for those of us who predominantly work within Tableau, may find that the sudden lack of parameters a daunting task when creating dashboards and reports. Add to that PowerBI’s learning curve and it may seem like all of the tricks you’ve picked up in Tableau are inapplicable. However, there’s a way to have a similar function in PowerBI, although it requires more steps, it will provide the same result at the end of the day.

Firstly, you’ll need to create a new table within PowerBI, and have three columns inside it; Measure, Measure Code, and Format. Now, I don’t believe that the actual names of these columns need to explicitly be as I’ve stated, but it’s still good practice to have them be something easily identifiable. Simply put this table is purely visual, Measure is what will show up in your slicer in the front-end, whereas Measure Code will dictate the DAX to work in the back-end and Format will set the numbers accordingly. The need for an additional column for Measure Code is just so that you won’t be constantly typing out the entire name of the measure, especially if they’re particularly long within the DAX.

Next, create a measure and enter in the following code:

VAR vSelected = SELECTEDVALUE(‘1′[Measure Code])
    vSelected = “sell”, DIVIDE(sum(‘Table'[sell_price_min]), 10000),
    vSelected = “buy”, DIVIDE(SUM(‘Table'[buy_price_max]),10000),
What this is telling PowerBI to do is if the Measure Code is true then return a specific measure, in this case, if the Measure Code is “sell”, then it’ll return the measure [sell_price_min] from ‘Table’ divided by 10000. The beauty of this part of the process is that you can apply further calculations within this stage, as I’ve done in the example to perform a division rather than create a separate measure with said calculation within it due to knowing that I’d only need to use it in this specific measure here.
I’ll note here that you can add as many rows into the table as needed, and this can be easily achieved by pressing the cog at Source within PowerQuery. All that’s needed is for the actual measure itself to be updated with extra lines in the “vSelected=” syntax.
After that you’re basically all ready to go! Drag your select measure into a visualisation and the Measure Name into a slicer and you’ve got a chart whose data is modifiable and selectable by the slicer. This is especially useful in making clean and compact reports in PowerBI and can fit in a lot of the usual functionality such as drill throughs and charts within the tooltips on specific measures. This is by far the most useful thing I’ve learnt so far in PowerBI reporting, and is something that is basically infinitely scalable to the amount of measures you want to include.
Daniel Yam
Author: Daniel Yam