Using Aggregations on Parameterized Snippets calling SQL Views

I love Jan's post on how to use filters/snippets/views as parameters in a snippet (read about it here!) Here, he utilizes double bracket notation to properly reference his view in the SQL snippet.

I just had a case where a customer wanted to leverage this approach, but also wished to aggregate the results in their view. To do this, we'd use an alias to make our bracket notation more manageable:

select [alias.column_name:aggregation]
from [[view_name] as alias]

Happy Periscoping :)

2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Thanks for posting Neha .
    I read  Jan 's post as well as this, but it is extremely abstract without a concrete example. 

    Are either of you able to share an actual working example? (or anyone else?)  

    Reply Like
      • Neha Kumar
      • Solutions Engineer
      • Neha_Kumar
      • 1 yr ago
      • Reported - view

      ryan I added some more detail in an example below:

      This would be the title of your snippet: snippet_example(view_name)

      select [a.created_at:month]
      from [[view_name] as a]

      Then, in your query, you can call

      snippet_example(my_view)

      Let me know if this helps!

      Reply Like
Like Follow
  • 1 yr agoLast active
  • 2Replies
  • 550Views
  • 2 Following