Still need help with pivots - Single Column Pivot

More
1 year 11 months ago - 1 year 11 months ago #24095 by prashant
sigh !

I think I need an intervention when it comes to pivot and unpivot 

Let's start with pivot, I understand it can do some incredible grouping , but I can't even wrap my head around single pivot  


Excel Terms
I want to pivot on Field Status, So Column Becomes Status , Rows = Brands , and Record id# is the value I want to "COUNT"

EDT Terms
Set Key ?; Pivot Key = Status  ; Pivoted Value= ?

What does Pivot Keys do here?

Input
 


Output
 


Expected Output from  Entire Dataset




File Attachment:

File Name: output.xls
File Size:7 KB

File Attachment:

File Name: input.xls
File Size:17 KB
Last edit: 1 year 11 months ago by prashant.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24102 by Peter.Jonson
You need to sort and group the data first.

I will create an example for you

Peter Jonson
ETL Developer
The following user(s) said Thank You: prashant

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago - 1 year 11 months ago #24103 by Peter.Jonson
Please see attached working example.



 

Peter Jonson
ETL Developer
Attachments:
Last edit: 1 year 11 months ago by Peter.Jonson.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24107 by prashant
HI,

Thanks for the example .it's clear(ish) now. Let me try 

0. Sorting is critical 
1. Pivot by itself will not do any calculations (sum/count)
2. To do this grouper is required where we employ Group by fields and actually do calculations we want
3. IN pivot , PivotKey is where we list down ALL the columns we want, if a pivot key is NOT listed that "value" will not be a part of output 
4. In example provided , I could have , not removed Record ID# using field selector , and instead used counting in Record ID#??

I am going to do a video on this, this would be helpful for me in future to remember , or for someone in my team as well

Now this is the easy Single Column Pivot  .
The wiki talks about a slightly complex pivot , can I get the example file for that (if you have)



 
The following user(s) said Thank You: Peter.Jonson

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24113 by Peter.Jonson
In example provided , I could have , not removed Record ID# using field selector , and instead used counting in Record ID#??

>>>I think this will work as well, as you can see there are multiple ways of doing things with our software 

The wiki talks about a slightly complex pivot , can I get the example file for that (if you have)

>>. Yes we do have it in default repository 0037 Pivot Example.

PS you are not the only one who is confused about the pivot (I keep forgetting how it works)
 

Peter Jonson
ETL Developer

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #24116 by prashant
Video as promised for Future Self
www.loom.com/share/4bbb2898938740eabd256...6b-8a62-2ee63c3eacc5

Do you know there is an upper limit to characters in Pivot Key for some reason ? Please remove , makes user job difficult  . See video at 4:24 to know what I am talking about

Please Log in or Create an account to join the conversation.

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Marketing
Set of techniques which have for object the commercial strategy and in particular the market study.
Google
Accept
Decline
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Google Analytics
Accept
Decline
Functional
Tools used to give you more features when navigating on the website, this can include social sharing.
Advertisement
If you accept, the ads on the page will be adapted to your preferences.
Google Ad
Accept
Decline
Save