Scenario
I am using Superstore data. I have a dimension named Product Name. I want to filter out the data which contains some of given string by user.
To achieve this, We need to play with Parameter and Calculated field. Now, why we are using these things.
Parameter - When ever there is any need to get input from user, we need to use Parameter. You can create parameter by two ways:
1) Right click on any dimension and select Create - Parameter....
2) Click drop down arrow on right side of Dimension shelf header.
Using any of those two method you will have parameter. Now will have a window with some of option to create it.
Name: Any name you can put here as per your requirement.
Data Type: The data property, Float, String, Date, Boolean, etc. Option below depends on the data type selected.
Current Value: First selected value.
Display Format: This will format the displayed data.
Allowable values:
- All - Selecting this, user can any input depends on data type selected. User will get a text box to type in.
- List - Using list, you will have a list of the data as drop down. You need to enter Value and Display As. You can have different text in both the options. But, keep in mind that, you will play on Value for any calculation.
- You can manually enter the values or paste from other source using "Paste from Clipboard".
- If you want to have the actual values coming into a dimension, then you can use "Add from field".
- Range - Range will give you a slider to choose any value from data.
- Minimum: If you want to have a minimum value for this parameter, you can put that value in this field.
- Maximum: If you want to have a max value for this parameter, you can put that value in this field.
- Step Size: This field indicate the different between on every slide. Like, your current value is 5 and step size is 2. Then, when you slide up the parameter this will add 2 to current value and on slide down it will show 3 on each slide.
Calculated Fields - Calculated fields are like a result of any formula using different kind of statements and functions. Like parameter, you can create this also by two same ways. Just need to click on Create Calculated Field... option.
Now let's start with the actual scenario. How we will use both parameter and calculated fields.
Below are the steps to get this done,
1) As we want to filter out Product Name ans it's data type is String. So we need to create a parameter as data type string.
After creating this, it will show under Parameter shelf. Just just need to right click and select show parameter.
2) Now, we need to create a calculated field as below. I have created two types of parameter, which returns Boolean and String with two different formulas. You can achieve this task by both ways.
If you are going with Boolean, you just need to put this in filter shelf selected as True.
If you are using String, then you just need to use this in Row shelf.
You will have the below view after going all this.
You can have the workbook by clicking on the link. Workbook - How to use parameter with filter?
If you have any question, please comment below.
No comments:
Post a Comment