cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Parameters Passing to dataset in Databricks Lakeview Dashboard

Pragati_17
New Contributor II

I have a date range filter in Lakeview Dashboard and i want to distinct count number of months in selected date range filter and divide it with one of the columns and that column is used in counter viualization. But passing parameters is not possible to databricks. How to achieve this in Databricks Lakeview Dashboard. 

1 REPLY 1

Kaniz_Fatma
Community Manager
Community Manager

Hi @Pragati_17, Letโ€™s break down the steps to achieve this in Databricks Lakeview Dashboard:

  1. Define Your Datasets:

  2. Create a Date Range Filter:

  3. Distinct Count of Months:

    • To calculate the distinct count of months within the selected date range, youโ€™ll need to create a new dataset or modify an existing one.
    • Write a query that extracts the month from your date column and performs a distinct count. For example:
      SELECT DISTINCT MONTH(date_column) AS month
      FROM your_dataset
      WHERE date_column BETWEEN start_date AND end_date
      
    • Replace date_column, your_dataset, start_date, and end_date with your actual column name, dataset, and date range filter values.
  4. Column Division:

    • Assuming you have another column (letโ€™s call it value_column) that you want to divide by the distinct count of months, create a new dataset or modify an existing one.
    • Write a query that calculates the sum of value_column and divides it by the distinct count of months:
      SELECT SUM(value_column) / COUNT(DISTINCT MONTH(date_column)) AS result
      FROM your_dataset
      WHERE date_column BETWEEN start_date AND end_date
      
    • Again, replace placeholders with your actual column names and filter values.
  5. Create a Counter Visualization:

    • Use the Canvas tab to create a visualization that displays the result of the division (e.g., a counter).
    • Add the appropriate widgets and customize your visualization as needed.
  6. Publish Your Lakeview Dashboard:

    • Once youโ€™re satisfied with your dashboard, publish it to share informative data insights with your team.

Remember to adjust the queries and column names according to your specific use case. Lakeview dashboards allow you to manage permissions to datasets alongside visualization permissions,...1.

Happy dashboarding! ๐Ÿ“Š๐Ÿš€

 
Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!