DYNAMIC COLUMN SELECTION USING POWERBI PARAMETERS

Dynamic Column Selection using Power BI Parameters allows users to interactively choose which column of data they want to analyze or visualize by using what-if parameters or field parameters. This technique creates flexibility in reports by enabling users to change measures or dimensions shown in charts without modifying the report itself. to do this;

  1. Open your powerBI desktop and load the sample data set (default data set)
    1. Select the financials and load it 
    1. The data will be previewed and it will appear under the data section at the right
    2. We will add a new table to create a measure that will get the sum of the columns sales, profit, discount and gross sales.
    3. To do this, click on enter data
    1. In the bar that will appear, rename it to measure and load
    1. It has been added to the data session. Click on the three dots on the measure and select new measure.
    1. Click on the new measure created and in the formula bar, write a formula for sum of sales and enter. That is, sales = SUM(financials(sales))
    C:\Users\user\Desktop\bluetooth\1744070489141.jpg
    1. You will see the measure name change to sales. Click on the three dots on column 1 above and in the bar that will appear, select delete from model. The table will now remain as a measure table.
    C:\Users\user\Desktop\bluetooth\1744070489116.jpg
    1. For profit, Click on the three dots on the measure and select new measure.
    2. Click on the new measure created and in the formula bar, write a formula for profit and enter. That is  profit = SUM(financials(profit))
    C:\Users\user\Desktop\bluetooth\1744070489093.jpg
    1. For discount, Click on the three dots on the measure and select new measure.
    2. Click on the new measure created and in the formula bar, write a formula for profit and enter. That is  discount = SUM(financials(discount))
    C:\Users\user\Desktop\bluetooth\1744070489044.jpg
    1. For gross sales, Click on the three dots on the measure and select new measure.
    2. Click on the new measure created and in the formula bar, write a formula for profit and enter. That is  gross sales = SUM(financials(gross sales))
    C:\Users\user\Desktop\bluetooth\1744070489019.jpg
    1. After getting your measures into the measure table, we navigate to the modelling tab.
    C:\Users\user\Desktop\bluetooth\1744070488995.jpg
    1. Go to parameter, on the dropdown bar, click on fields parameter.
    C:\Users\user\Desktop\bluetooth\1744070488971.jpg
    1. Select measures and drag them into the Add and Reorder fields. Bring sales, profit, discount and gross sales and hit the create button. It will automatically add it to a powerbi slicer.
    C:\Users\user\Desktop\bluetooth\1744070488946.jpg
    1. Drag the slicer, go to build visual, select the middle tab.
    C:\Users\user\Desktop\bluetooth\1744070488921.jpg
    1. Click on the slicer settings, change the style to Tile and you will see our slicer displayed as tile.
    C:\Users\user\Desktop\bluetooth\1744070488872.jpg
    C:\Users\user\Desktop\bluetooth\1744070488847.jpg
    1. To get a stacked bar chart, click on the stacked bar chart in visualization
    C:\Users\user\Desktop\bluetooth\1745998662565.jpg
    1. We can be able to do sales, profit, discount and gross sales in one axis. To do this, click on parameter
    C:\Users\user\Desktop\bluetooth\1745998662523.jpg
    1. Go to table view, click on the eye icon on parameter and unhide it so that we can get the parameter field.
    C:\Users\user\Desktop\bluetooth\1745998662488.jpg
    1. Once you do that, it will appear in the report view.
    C:\Users\user\Desktop\bluetooth\1745998662453.jpg
    1. In the report view, drag the parameter field into the x axis 
    C:\Users\user\Desktop\bluetooth\1745998662422.jpg
    1. In the data, go to the financials and select product, get it into the y axis. The sales, product, discount and gross sales are now in one axis.
    C:\Users\user\Desktop\bluetooth\1745998662347.jpg
    1. We can now select the names in the tiles to see each chart for sales, product, discount and gross sales.
    C:\Users\user\Desktop\bluetooth\1745998662305.jpg
    1. Add a conditional statement so that each category can display a different chart colour. To do this, click on the created stack bar chart, click on format visual and scroll down to the bars. Click on fx (conditional formatting)
    C:\Users\user\Desktop\bluetooth\1745998662265.jpg
    1. Go to what field should we base this on and select parameter
    C:\Users\user\Desktop\bluetooth\1745998662226.jpg
    1. Go to the section of if value is and edit the text to sales, select colour of your choice. In this example, we make use of the default colour, sky blue.
    C:\Users\user\Desktop\bluetooth\1745998662189.jpg
    1. Go to new rule to add another rule.
    C:\Users\user\Desktop\bluetooth\1745998662151.jpg
    1. If value is, edit the text to  profit, select green colour
    C:\Users\user\Desktop\bluetooth\1745998662115.jpg
    1. Add new rule, if value is discount, select colour of your choice
    C:\Users\user\Desktop\bluetooth\1745998662080.jpg
    1. Add new rule, if value is gross sales, select colour and click on ok
    C:\Users\user\Desktop\bluetooth\1745998662040.jpg
    1. Navigate through and you will notice that the colours of the carious charts will change
    C:\Users\user\Desktop\bluetooth\1745998662001.jpg

    Leave a Reply

    Your email address will not be published. Required fields are marked *