Group Data by Month-Year and not Full Date

https://www.appsheet.com/Template/AppDef?appName=NewTestPhotoUpload-3272358

I want to group my data by month and not the full date. Please let me know a way as to how i can do that? Creating a virtual column doesnt work as the formula returns a Text For eg 1 for January, 2 for February etcโ€ฆI feel this should have been a standard and easy feature but havent found a way yet!

Using the Month or eomonth formula returns month as a number and appsheet doesnt detect numbers as a dateโ€ฆ

KIndly Help

0 18 1,698
18 REPLIES 18

Aurelien
Google Developer Expert
Google Developer Expert

Hi @AnujKhadria, and welcome to the community !

You may want to use a virtual column, with a combination of
SWITCH and MONTH([TimeStamp])

Something like:

SWITCH( MONTH([TimeStamp]),
   1,"january", 
   2, "february",
   ....
   11,"november",
   "december"
)

EDIT : forgot a comma

Dear,

This is the formula i Typed and this is the error I am getting. Please Help.

Column Name is โ€œDateโ€ in my table.

Formula As Follows:-

=SWITCH(Month([Date]),1,โ€œJanuaryโ€,2,โ€œFebruaryโ€,3,โ€œMarchโ€,4,โ€œAprilโ€,5,โ€œMayโ€,6,โ€œJuneโ€,7,โ€œJulyโ€,8,โ€œAugustโ€,9,โ€œSeptemberโ€,10,โ€œOctoberโ€,11,โ€œNovemberโ€,12,โ€œDecemberโ€)

Error as follows:-

SWITCH function is used incorrectly: Inputs to SWITCH() must be an initial expression, one or more value-result pairs, and a default result

@AnujKhadria

The last input is a default value.
No need to explicit 12 for december

SWITCH (valueToTest,
   value1, result1,
   value2, result2, 
   defaultResult
)

Please have a look to the link I provided above

Hi,

This formula is working but i am unable to group by Month-Year.

Good for the formula

For grouping, please navigate in the UX panel, and pick a view type that matches your expectations (Table, for example).
3X_e_7_e7e305e0a181325f437fcfc9aad4c92447967e44.png

Then, choose the โ€œGroup byโ€ option you want.
3X_9_a_9a47647c024ba37c7ee64c29ebecc35e18e9aa9c.png
In your case, the month_year column.

If that answers your question, please remember to tick the post as โ€œSolutionโ€
Let us know if that works for you !

I already tried this but this still groups by Full Date!

Grouping by month should have been easier i feel, Shouldnt be so complicated, its so basic!

Can you please provide a capture of the view panel you are using, its result on the preview and the section of the Table where you set name, formula, show/editable/require etc for this column Month_year ?

Hello, i just read all things you typed and its very nice but the problem is i cant group with Month still any ideas how to group with month ? 

Meaning what?

Just completed it and it group by Month for anyone whoโ€™s going to come across it.
Now, just have to add year too.

Incase it helps anyone out:

CONCATENATE(
YEAR([SALES_DATE]),
"-",
SWITCH(Month([SALES_DATE]),1,โ€œJanuaryโ€,2,โ€œFebruaryโ€,3,โ€œMarchโ€,4,โ€œAprilโ€,5,โ€œMayโ€,6,โ€œJuneโ€,7,โ€œJulyโ€,8,โ€œAugustโ€,9,โ€œSeptemberโ€,10,โ€œOctoberโ€,11,โ€œNovemberโ€,โ€œDecemberโ€)
)

It will give YEAR-MONTH_NAME: 2021-August

Hi @LengliimAdmin

Very nice to share

Another way to proceed, that I tested earlier today:

CONCATENATE(
YEAR([SALES_DATE]),
"-",
SWITCH(Month([SALES_DATE]),1,โ€œJanuaryโ€,2,โ€œFebruaryโ€,3,โ€œMarchโ€,4,โ€œAprilโ€,5,โ€œMayโ€,6,โ€œJuneโ€,7,โ€œJulyโ€,8,โ€œAugustโ€,9,โ€œSeptemberโ€,10,โ€œOctoberโ€,11,โ€œNovemberโ€,โ€œDecemberโ€)
)

can also be achieved this way:
TEXT([SALES_DATE],"yyyy-mmmm")

However, I have no idea of the most efficient expression

For reference:

Thank you for sharing. It looks much cleaner now.

Assuming English is the desired language.

Hi @Steve
I thought so, butโ€ฆactually, that works with French too

I just set the locale table to French, so I guess now thatโ€™s OK.

Then I put this expression:
TEXT([TimeStamp],"YYYY_MM_DD (MMMM - DDDD)")
hereโ€™s the result
3X_9_9_99e9fd246369a5f9ce324d0e5ced1455bdef0812.png

People at the Dev Team have been working very nice !

Whoa! Neat! Thanks for educating me!!!

Itโ€™s possible to teach something to @Steve โ€ฆwowโ€ฆ
I feel like going from padawan to something else

Thanks to you all the nice guys.๐Ÿ™๐Ÿ˜

Hi @Aurelien ! Thanks for the response. In this context I would like to share one instance that when the date format was changed from the default to "dd/mm/yyyy", it orders the data differently for the group by data, so far I had gone through.

Thanks.

Top Labels in this Space