cancel
Showing results for 
Search instead for 
Did you mean: 
LukeG
Employee
Employee

Introduction

Presentation variables allow dashboard developers to give viewers the power of self-service and flexibility. These variables are set by users when viewing the dashboard, and they can be referenced in several ways to create dynamic insights. Before we demonstrate three examples of how presentation variables can be used, let’s cover the basics about what they are on their own.

Presentation variables…

  • only exist within the scope of the given dashboard and the user interacting with the dashboard
  • are mutable by design, meaning user interactions can set the value of the variables
  • override the existing column filter list (just like user-defined prompts)
  • do not filter or affect the dashboard on their own

When a user sets a presentation variable, the value is stored in a named variable. Until that named variable is referenced somewhere in the dashboard, the user will not see any changes to their view. Let’s explore three ways to utilize presentation variables.

  1. Update a filter for dynamic date ranges
  2. Update a conditional formatting threshold
  3. Update aggregation and grouping methods with tables

For more information about how to create a presentation variable, see our Documentation Guide about Presentation Variables

Update a conditional formatting threshold

We can use the value of our presentation variable to update insight filters and measure properties. In this example we will update the value for a conditional formatting property.

 

LukeG_0-1652968865640.png

Revenue values for each category/subcategory are displayed in an aggregated table. Our conditional formatting property displays values greater than 10,000,000 in green. Rather than using a static number, we will use the value set by our user with a presentation variable. To do this, simply update the value in the measure properties from 10,000,000 to the name of the presentation variable ($pv_GreaterThan).

 

LukeG_1-1652968865604.png

 

Update a filter for dynamic date ranges

In this example, we configured a presentation variable ($pv_DateFilter) to have four predefined values for the end user to select (Previous Day, Previous 30 Days, Previous 90 Days, and None). These four options will update the numeric values on an insight to display the total revenue over the selected period.

The formula below can be applied as an individual filter to the insights panel. The formula ensures that the number of days between the current date ($currentDate) and the sale date (Online_Store.OrderDetails.NewDate) meets the condition specified. If “None” is selected. All transactions will be returned.

 

LukeG_2-1652968865661.png
or(

and

($pv_DateFilter = "Previous Day", 

daysBetween($currentDate, Online_Store.OrderDetails.NewDate) = 1), 

and

($pv_DatePeriod = "Previous 30 Days", 

daysBetween($currentDate, Online_Store.OrderDetails.NewDate) < 30), 

and

($pv_DatePeriod = "Previous 90 Days", 

daysBetween($currentDate, Online_Store.OrderDetails.NewDate) < 90), 

and

($pv_DatePeriod = "None", 1 = 1)

)

 

The screenshots below demonstrate the update to the insight when the presentation variable is changed from “None” to “Previous 30 Days”.

 

LukeG_3-1652968865561.png

 

LukeG_4-1652968865575.png

Dynamic group by methods with tables

In this example, we will allow an end user to decide the grouping field for an aggregated table.  Dashboard developers can make these updates very easily by editing a dashboard insight itself, but the presentation variable in this case allows an end user to make updates without edit access.

Like our previous example, we have a predefined variable list to choose from. Our insight requires us to use a case statement for our Group By field. The option the user selects will update the field that is used for grouping at runtime.

 

LukeG_5-1652968865643.png

 

case(

    $pv_GroupBy = "Category", 

    SALES.PRODUCTS.PROD_CATEGORY, 

    $pv_GroupBy = "Subcategory", 

    SALES.PRODUCTS.PROD_SUBCATEGORY, 

    $pv_GroupBy = "Product", 

    SALES.PRODUCTS.PROD_NAME, 

    $pv_GroupBy = "Quarter", 

    date.date.QuarterName, 

    string(

        SALES.SALES.CALENDAR_YEAR

    )

)


The screenshots below demonstrate the update to the insight when the presentation variable is changed from “Category” to “SubCategory”.

LukeG_6-1652968865650.png

 

LukeG_7-1652968865626.png

 

Related Material

Guides – Presentation Variables

Concepts – Presentation Variables

Guides – Conditional Format

Concepts – Individual Filter



Best Practices Index
Best Practices

Just here to browse knowledge? This might help!

Contributors
Version history
Last update:
‎05-19-2022 11:42 AM
Updated by: