Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: grouping dimensions and metrics #2680

Merged
merged 6 commits into from Jul 13, 2022
Merged

feat: grouping dimensions and metrics #2680

merged 6 commits into from Jul 13, 2022

Conversation

ZeRego
Copy link
Contributor

@ZeRego ZeRego commented Jul 12, 2022

Closes: #1851

Description:

Changes:

  • added support for groupLabel in the dimension/metric/dbt metric yml
  • moved table tree component next to the explore tree component
  • render group in sidebar
  • allow node click to expand group ( currently only expands on click the arrow icon )

Screenshot 2022-07-12 at 13 31 41

groups

yml example:

      - name: created
        meta:
          dimension:
            groupLabel: Dates
          metrics:
            date_of_most_recent_created_customer:
              type: max
              group_label: Dates

@ZeRego ZeRego requested a review from a team July 12, 2022 12:35
@ZeRego ZeRego self-assigned this Jul 12, 2022
@owlas owlas requested a deployment to feat/grouping-fields - jaffle_db PR #2680 July 12, 2022 12:36 — with Render Abandoned
@netlify
Copy link

netlify bot commented Jul 12, 2022

Deploy Preview for peaceful-bassi-cbf284 ready!

Name Link
🔨 Latest commit 23db04d
🔍 Latest deploy log https://app.netlify.com/sites/peaceful-bassi-cbf284/deploys/62cd7bfcbeb3e40009f6c3d7
😎 Deploy Preview https://deploy-preview-2680--peaceful-bassi-cbf284.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@owlas owlas temporarily deployed to feat/grouping-fields - lightdash PR #2680 July 12, 2022 13:37 — with Render Destroyed
@owlas owlas temporarily deployed to feat/grouping-fields - lightdash PR #2680 July 12, 2022 13:49 — with Render Destroyed
@hamzahc1
Copy link
Contributor

Does this also let you search by the group name in the sidebar?

@Martin-Carlsson
Copy link

Does this only allow for one level of grouping?

Could we allow for something like this:

     - name: created
        meta:
          dimension:
            groupLabel: Sales/Customers/Dates
          metrics:
            date_of_most_recent_created_customer:
              type: max
              group_label: Sales/Customers/Dates

@Martin-Carlsson
Copy link

Are we able to order groups?

@ZeRego
Copy link
Contributor Author

ZeRego commented Jul 12, 2022

Does this also let you search by the group name in the sidebar?

@hamzahc1 Current implementation only searches dimensions and metrics. How would the search work in that case (both groups and dimensions/metrics? Would it show the group empty if the search matches the group label but doesn't match any of the dimensions inside ?

Does this only allow for one level of grouping?

@Martin-Carlsson Currently yes, this ticket is to provide the basic functionality and after getting feedback, like yours, we will keep improve it.
Note that the sidebar already has a deep hierarchy with 5 levels, Table -> dimensions/metrics group -> custom group -> dimension/metric -> date interval dimension so perhaps we need to rethink this structure if we want to support nested grouping labels. 🤔 I created a new ticket for it #2686

Are we able to order groups?

@Martin-Carlsson Right now it is possible to force the order by prefixing the label with numbers or white spaces.
Eg:
group_label: 'Third'
group_label: ' Second' // has 1 white space so its second
group_label: ' First' // has 2 white spaces so it is first

If we want to have configuration for the group labels we might need to add it in the model meta.

models:
  - name: customers
    meta:
      group_labels:
          - name: Test
            order: 1
          - name: "Another Test"
            order: 2

cc: @TuringLovesDeathMetal

Copy link
Collaborator

@rephus rephus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks great, let me test this locally

@rephus
Copy link
Collaborator

rephus commented Jul 13, 2022

If you select a dimension within a group, you can't collapse the group, is that intentional ?
Peek 2022-07-13 08-58

@rephus
Copy link
Collaborator

rephus commented Jul 13, 2022

Works like a charm 👌
image

@ZeRego
Copy link
Contributor Author

ZeRego commented Jul 13, 2022

Closing this ticket as it provides the simplest version of grouping.
We have a separate ticket in our backlog to change the sidebar UI/UX #2685. Feel free to add suggestions in that ticket 😃

@ZeRego ZeRego merged commit 10b6740 into main Jul 13, 2022
@ZeRego ZeRego deleted the feat/grouping-fields branch July 13, 2022 11:15
github-actions bot pushed a commit that referenced this pull request Jul 13, 2022
# [0.181.0](0.180.1...0.181.0) (2022-07-13)

### Bug Fixes

* edit table calculation ([#2696](#2696)) ([eb0871d](eb0871d))
* filter from table ([#2682](#2682)) ([c2e79bb](c2e79bb))
* format table viz totals ([#2693](#2693)) ([bcd81d7](bcd81d7))

### Features

* grouping dimensions and metrics ([#2680](#2680)) ([10b6740](10b6740))
@github-actions
Copy link

🎉 This PR is included in version 0.181.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I want to group together common metrics/dimensions in my Explores.
5 participants