Fixed
Status Update
Comments
bl...@google.com <bl...@google.com>
lk...@google.com <lk...@google.com>
me...@google.com <me...@google.com>
ce...@gmail.com <ce...@gmail.com> #2
is there any news on this?
el...@google.com <el...@google.com> #3
You can pivot already, e.g. using a conditional aggregation: https://stackoverflow.com/questions/50796224/pivot-rows-in-big-query . Client tools such as Sheets, Excel, Data Studio, etc. are almost always in a better position to pivot the data returned by BigQuery since if you want to do it in a single BigQuery query, you need to provide the list of values and column names to pivot.
ce...@gmail.com <ce...@gmail.com> #4
I had to implement a solution to pivot 300 rows into columns. We need a better way to pivot rows. Conditional aggregation or sql generators are cumbersome and error-prone.
el...@google.com <el...@google.com> #5
Even Kurt's example linked above still requires you to write out 300 clauses for each column. Generating SQL really is the best option.
pe...@gmail.com <pe...@gmail.com> #6
We want something like:
SELECT * FROM
(
SELECT
category_name,
product_id
FROM
production.products p
INNER JOIN production.categories c
ON c.category_id = p.category_id
) t
PIVOT(
COUNT(product_id)
FOR category_name IN (
[Children Bicycles],
[Comfort Bicycles],
[Cruisers Bicycles],
[Cyclocross Bicycles],
[Electric Bikes],
[Mountain Bikes],
[Road Bikes])
) AS pivot_table;
SELECT * FROM
(
SELECT
category_name,
product_id
FROM
production.products p
INNER JOIN production.categories c
ON c.category_id = p.category_id
) t
PIVOT(
COUNT(product_id)
FOR category_name IN (
[Children Bicycles],
[Comfort Bicycles],
[Cruisers Bicycles],
[Cyclocross Bicycles],
[Electric Bikes],
[Mountain Bikes],
[Road Bikes])
) AS pivot_table;
el...@google.com <el...@google.com>
th...@google.com <th...@google.com>
ce...@gmail.com <ce...@gmail.com> #7
Is there a progress on this issue? :)
pe...@gmail.com <pe...@gmail.com> #8
Any update regarding PIVOT functionality?
[Deleted User] <[Deleted User]> #10
update!
[Deleted User] <[Deleted User]> #11
not sure where to upvote so writing here instead. i would love this!
ry...@energydrive.co.za <ry...@energydrive.co.za> #12
Yes please!
an...@storrs.ca <an...@storrs.ca> #13
Yes, great idea!
de...@iwc.com <de...@iwc.com> #14
Would be very helpful indeed.
[Deleted User] <[Deleted User]> #15
Yes, great idea!
al...@gmail.com <al...@gmail.com> #16
Would like to use that too
bc...@gmail.com <bc...@gmail.com> #17
+1
[Deleted User] <[Deleted User]> #18
+1
mi...@gmail.com <mi...@gmail.com> #19
+1
[Deleted User] <[Deleted User]> #20
+1
[Deleted User] <[Deleted User]> #21
+1
mi...@gmail.com <mi...@gmail.com> #22
+1
[Deleted User] <[Deleted User]> #23
+1
[Deleted User] <[Deleted User]> #24
+1
va...@gmail.com <va...@gmail.com> #25
+1
bw...@google.com <bw...@google.com>
no...@google.com <no...@google.com> #26
+1
ad...@sablecard.com <ad...@sablecard.com> #27
+1
an...@ngpcap.com <an...@ngpcap.com> #28
+1
bw...@google.com <bw...@google.com>
mi...@gmail.com <mi...@gmail.com> #29
+1
[Deleted User] <[Deleted User]> #30
+1
be...@cherre.com <be...@cherre.com> #31
+1
[Deleted User] <[Deleted User]> #32
+1
al...@pearson.com <al...@pearson.com> #33
+1
en...@gmail.com <en...@gmail.com> #34
+1
jo...@hotmail.co.uk <jo...@hotmail.co.uk> #35
+1
am...@gmail.com <am...@gmail.com> #36
+1
ar...@gmail.com <ar...@gmail.com> #37
+1
ad...@gmail.com <ad...@gmail.com> #38
+1
jc...@gmail.com <jc...@gmail.com> #39
+1
[Deleted User] <[Deleted User]> #40
+1
lu...@gmail.com <lu...@gmail.com> #41
+1
ka...@gmail.com <ka...@gmail.com> #42
+1
[Deleted User] <[Deleted User]> #43
+1
[Deleted User] <[Deleted User]> #44
+1
[Deleted User] <[Deleted User]> #45
+1
ch...@bstock.com <ch...@bstock.com> #46
+1
pp...@cludo.pl <pp...@cludo.pl> #47
+1
ao...@googlemail.com <ao...@googlemail.com> #48
+1
ar...@biocogniv.com <ar...@biocogniv.com> #49
Yes to this please! We've been using pivots everywhere, alas the queries to build them are cumbersome and slow.
+1 for this feature – esp if it's optimized!
+1 for this feature – esp if it's optimized!
ma...@playtomic.io <ma...@playtomic.io> #50
+1
jo...@worklytics.co <jo...@worklytics.co> #51
+1
[Deleted User] <[Deleted User]> #52
+1
gv...@google.com <gv...@google.com> #53
+1
mw...@claimsolution.com <mw...@claimsolution.com> #54
+1
mb...@stylepit.com <mb...@stylepit.com> #55
+1
[Deleted User] <[Deleted User]> #56
+1
an...@optus.com.au <an...@optus.com.au> #57
+1
el...@waitrose.co.uk <el...@waitrose.co.uk> #58
+1
[Deleted User] <[Deleted User]> #59
+1
be...@gmail.com <be...@gmail.com> #60
+1
[Deleted User] <[Deleted User]> #61
we would love to have this. +1 +1
ch...@gmail.com <ch...@gmail.com> #62
+1
wk...@gmail.com <wk...@gmail.com> #63
+1
ni...@gmail.com <ni...@gmail.com> #64
+1
ay...@gmail.com <ay...@gmail.com> #65
+1
tu...@bouvet.no <tu...@bouvet.no> #66
+1
ru...@ringside.ai <ru...@ringside.ai> #67
+1
aa...@schnucks.com <aa...@schnucks.com> #68
+1
da...@darrenhe.com <da...@darrenhe.com> #69
Please implement!
co...@thenextcloset.com <co...@thenextcloset.com> #70
+1
ma...@gmail.com <ma...@gmail.com> #71
+1
fl...@gmail.com <fl...@gmail.com> #72
+1
ne...@ae.com <ne...@ae.com> #73
+1
ka...@gmail.com <ka...@gmail.com> #74
+1
da...@emerysapp.com <da...@emerysapp.com> #75
+1
ml...@gmail.com <ml...@gmail.com> #76
+1
ar...@loblaw.ca <ar...@loblaw.ca> #77
+1
da...@aller.com <da...@aller.com> #78
+1
gr...@platform.sh <gr...@platform.sh> #79
+1
yo...@gmail.com <yo...@gmail.com> #80
+1
[Deleted User] <[Deleted User]> #81
+1
iz...@gmail.com <iz...@gmail.com> #82
+1
[Deleted User] <[Deleted User]> #83
+1
[Deleted User] <[Deleted User]> #84
+1
[Deleted User] <[Deleted User]> #85
+1
nm...@falabella.cl <nm...@falabella.cl> #86
+1
tb...@gmail.com <tb...@gmail.com> #87
+1
[Deleted User] <[Deleted User]> #88
+1
lu...@loblaw.ca <lu...@loblaw.ca> #89
+1
tu...@gmail.com <tu...@gmail.com> #90
+1
jj...@hl.agency <jj...@hl.agency> #91
+1
du...@digital.cabinet-office.gov.uk <du...@digital.cabinet-office.gov.uk> #92
+1
aj...@gmail.com <aj...@gmail.com> #93
+1
ar...@smilingmind.com.au <ar...@smilingmind.com.au> #94
+1
[Deleted User] <[Deleted User]> #95
+1
[Deleted User] <[Deleted User]> #96
+1
ol...@blablacar.com <ol...@blablacar.com> #97
+1
ia...@pendo.io <ia...@pendo.io> #98
+1
[Deleted User] <[Deleted User]> #99
+1
[Deleted User] <[Deleted User]> #100
+1
ma...@theloyalist.com <ma...@theloyalist.com> #101
+1
br...@gmail.com <br...@gmail.com> #102
+1
na...@apmex.com <na...@apmex.com> #103
+1
ia...@kintosllc.com <ia...@kintosllc.com> #104
+1
da...@tinuiti.com <da...@tinuiti.com> #105
+1
pa...@gmail.com <pa...@gmail.com> #106
+1
ku...@googlemail.com <ku...@googlemail.com> #107
+1
ge...@gmail.com <ge...@gmail.com> #108
+1
mi...@pwc.com <mi...@pwc.com> #109
+1
at...@wayfair.com <at...@wayfair.com> #110
+1
cv...@gmail.com <cv...@gmail.com> #111
+1
[Deleted User] <[Deleted User]> #112
+1
er...@gmail.com <er...@gmail.com> #113
+1
va...@ingka.ikea.com <va...@ingka.ikea.com> #114
+1
kh...@justeattakeaway.com <kh...@justeattakeaway.com> #115
+1
ch...@gmail.com <ch...@gmail.com> #116
+1
ni...@gmail.com <ni...@gmail.com> #117
+1
dl...@woolworths.com.au <dl...@woolworths.com.au> #118
+1
an...@gmail.com <an...@gmail.com> #119
+1
ge...@gmail.com <ge...@gmail.com> #120
+1
bw...@google.com <bw...@google.com> #121
Thanks everyone for the suggestions. We are working hard on this one.
ke...@autopediacar.com <ke...@autopediacar.com> #122
+1
[Deleted User] <[Deleted User]> #124
+1
ma...@retool.com <ma...@retool.com> #125
+1
Description
I would like a feature that allows converting rows into columns in a pivot like style. Interestingly, spark SQL in the next release is doing something similar which looks super nice.
Such a capability in native BQ SQL would be super cool and useful. Im su
What you would like to accomplish:
- Pivoting data is very common, and excel is of course super easy. Ive needed to do similar with representations of financial data (stock / sales) for current year and last year for example, grouped by say season....such need is often for exec level dashboards
How this might work:
- Very similar to the spark model in the recent blog post! The examples show an intuitive use for this.
If applicable, reasons why alternative solutions are not sufficient:
- Im sure some SQL boffins could achieve similar but likely with some complex SQL (Mikhail or Elliott could do no doubt)?? Would be nice to have it as concise part of the BQ SQL language.