Configuring your behaviors
Now you will create a behavior. Behaviors enable you to set custom individual scope for how measure groups are used.
With behaviors, you can:
-
Enforce required selections of values from a field with a measure group.
-
Set which groups you prefer to be used with a measure group.
-
Set which groups you do not want used with a measure group.
-
Set a calendar period to be used by default with a measure group.
Behaviors are optional.
Why configure behaviors?
Like packages, behaviors help you set the scope for how groups are used together. Behaviors enable you to set narrow scope for how individual measure groups are used with other groups.
For example, when we search for fields from the Sales group in Sheet measure results for Gross Profits are aggregated across all time. It would be more useful if you had a more recent period of time applied. You can create a behavior to use one of your calendar periods by default.
Creating a default calendar period behavior
Do the following:
-
Click Create behaviors.
-
Under Applies to, select Sales.
-
Under Behavior type, select Default calendar period.
-
Under Calendar group, select Sales_OrderDate.
-
Under Period, select Month comparison.
-
Click Create.
Results
Navigate to Sheet and search for what is the average sales by employee. The matching results now displays a bar chart that compares this month's sales for each employee to the sales from the same month last year. For charts that do not support comparisons, only the results for the current month are shown.
Configure a behavior to use a default calendar period for Period over period analysis
You can also set a default calendar period behavior for a group that is applied to Period over period analysis. Period over period analysis type uses a line chart to compare a measure over the current period versus the previous period. It requires a default calendar period set for the group containing the measure in the logical model.
First, create a Quarter over quarter calendar period.
Do the following:
-
Click Create calendar period.
-
Select Sales_Order Date.
-
For Calendar period name, enter Quarter over quarter.
-
For Calendar period grain, select Quarter of year.
-
Select Use last sorted value.
-
Click Create.
Now in the Behaviors tab, set this calendar period as the default for the group Sales.
Do the following:
-
Click Create behavior.
-
Under Applies to, select Sales.
-
Under Behavior type, select Default calendar period.
-
Under Calendar group, select Sales_OrderDate.
-
Under Period, select Quarter over quarter.
-
Click Create.
Navigate to Discovery and search on show me sales. The first chart that appears below the KPI is a Period over period analysis. Open this chart (sum (Sales) for 2020-Q4 vs 2020-Q3) and navigate to the property Analysis period. Select it and note that the default calendar period Quarter over quarter was correctly selected to compare the most recent period to the previous period. In this tutorial those periods are 2020-Q3 (Period 1) and 2020-Q4 (Period 2). These selections can be changed by selecting different quarters from the drop-downs. A reference line indicates the current day in the current calendar period grain, which in this case is a quarter.
You can change this default calendar period in Analysis period.