Wednesday, June 7, 2017

yogi_WorkAround for Query() - Creating New Column by combining Year & Month

Google Spreadsheet   Post  #2176
Yogi Anand, D.Eng, P.E.      ANAND Enterprises LLC -- Rochester Hills MI     www.energyefficientbuild.com.   Jun-07-2017
question by KW LowTS:
https://productforums.google.com/forum/?utm_medium=email&utm_source=ba_notification#!topic/docs/fTNDCXkP0yg;context-place=forum/docs
Query() - Creating New Column by combining Year & Month

I have a query that returns the expected results
=query(A:D, "select A, B, C, D, YEAR(D), MONTH(D)+1 Label MONTH(D)+1 'ProfileCreatedMonth' FORMAT D 'MM/DD/YYYY'",1)

But, I'm trying to create a new column that is the combination of YEAR(D) & MONTH(D)+1 ie "2017-05" or "2016-12". Since query() does not allow merging columns and because dates are more complex to work with, can any recommend a workaround?

[Edited]Or even if there's a way to show a 2nd occurrence of D where I can FORMAT the 2nd occurrence of D to be 'YYYY-MM'. I need the 1st occurrence of D.

Thanks