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

[Idea] Group by fiscal year #263

Closed
jonathanloos opened this issue Nov 7, 2022 · 4 comments
Closed

[Idea] Group by fiscal year #263

jonathanloos opened this issue Nov 7, 2022 · 4 comments

Comments

@jonathanloos
Copy link

Hey everyone,

First off I would like to say how amazing groupdate has been to use on our platform so thank you from us at Harled.

I would like to propose the feature of grouping data by fiscal year as we've had quite a few needs surrounding it.

Example data:

Given a queryable set:

set = [
  {created_at: Jan 2021},
  {created_at: Feb 2021},
  {created_at: Mar 2021},
  {created_at: Apr 2021},
  {created_at: May 2021},
  {created_at: Jun 2021}
]

Example output:

# Assumes fiscal year is configured to start in April
# returns something along the lines of: {01 Jan 2021=>3, Sat, 01 Jan 2022=>3}
set.group_by_fiscal_year(:created_at).count

Additionally this will likely require the configuration of the "start date of a fiscal year" as it's not the same across the board.

Let me know if you need any other info 🙂

@ankane
Copy link
Owner

ankane commented Nov 8, 2022

Hey @jonathanloos, thanks for the suggestion. Added support in the year_start branch if you want to try it (it outputs the date the year starts rather than Jan 1). Still deciding if it's worth the additional complexity to support.

User.group_by_year(:created_at, year_start: :april).count

Edit: added code example

@jonathanloos
Copy link
Author

@ankane sorry for the delay, will look at in shortly!

@Sumit-Gems
Copy link

Sumit-Gems commented Apr 25, 2023

Hi Gyus, Any update on the feature of group by fiscal year?

As I can see above there is a branch that implement this feature but not yet merge into master. I saw the code and test as well, it will work as expected.

Do you guys have any plan to merge this?

@ankane
Copy link
Owner

ankane commented May 17, 2023

Hi @Sumit-Gems, don't think I want to support the extra complexity at this point.

@ankane ankane closed this as completed May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants