Skip to main content
All docs
V26.1
  • Use Dashboard Parameter Values in Calculated Fields

    • 2 minutes to read

    You can combine dashboard data with parameters in an expression to calculate values, such as average discounted prices, totals, or geographical coordinates.

    Note

    Before you begin, create and configure the discountParameter dashboard parameter.

    Follow these steps to create a calculated field that applies a parameter-based discount to the freight cost:

    1. Open the Dashboard Designer menu and click Data Sources:

      Dashboard Designer - Data Sources

    2. Click Add Calculated Field on top of the selected data source:

      Dashboard Designer - Add Calculated Field

    3. Combine dashboard parameters with data source fields using operators and functions. For example, the following expression calculates a discounted freight cost:

      [Freight] * ( 1 - ( ?discountParameter / 100 ) )
      

      Tip

      Enter a question mark (?) followed by the parameter name to reference a parameter: ?ParameterName.

      Dashboard Parameter Expression

    4. Click the OK button to save the expression.

    The following tutorial creates a parameter, assigns its value, and passes the value to a data source:

    Read Tutorial: Bind a Dashboard to a Parameterized Stored Database Procedure
    Follow this tutorial to create an application that obtains data from a stored database procedure and passes a dashboard parameter as a procedure parameter.

    This section lists all public GitHub repositories (DevExpress-Examples) that demonstrate primary usage scenarios for dashboard parameters:

    View Example: Generate Dashboards in a Backend / Service Application
    This example filters dashboard data by country name.
    View Example: Pass a Hidden Dashboard Parameter to a SQL Query
    This example displays sales data for a selected country. The example passes the country to the underlying SQL query as a hidden dashboard parameter.

    To see the dashboard export functionality in action, run the BI Dashboards Designer/Viewer demo in the VCL Demo Center installed with compiled DevExpress VCL demos. Select any demo in the sidebar on the left, click the Export button, and use any export option listed in the menu.

    Download: Compiled VCL Demos

    Compiled DevExpress demos ship with source code installed in the Public Documents folder (%PUBLIC%) for all users (default). You can find all project and source code files for the BI Dashboards Designer/Viewer demo in the following folder:

    %PUBLIC%\Documents\DevExpress VCL Demos\MegaDemos\Product Demos\ExpressDashboards\
    

    Tip

    Project and source code files for all compiled DevExpress VCL Demos are maintained in a public repository hosted on GitHub:

    View Example: DevExpress VCL Demos

    See Also