@@ -7,31 +7,11 @@ Data can be organized in different ways, for example, in a short/wide or tall/sk
7
7
| Transposing Wide Table into a Long Table using UNPIVOT for easier analysis|
8
8
9
9
## Example 1: Unpivot 3 Columns
10
- Suppose you have a Wide Table format Performance Ratings data as following:
11
-
12
- | NAME | ACTING_RATING | ACTING COMMENTS | COMEDY RATING | COMEDY COMMENTS | MUSICAL PERFORMANCE RATING | MUSICAL PERFORMANCE COMMENTS |
13
- | --------------| ---------------| -----------------| ---------------| -----------------| ----------------------------| ------------------------------|
14
- | Groucho Marx | 4 | Awesome | 3 | Super | 4 | Really good |
15
- | Harpo Marx | 4 | Awesome | 4 | Awesome | 4 | |
16
- | Groucho Marx | 4 | | 3 | Thumbs up | 4 | Nice |
17
- | Harpo Marx | 4 | Best Acting | 4 | Nice | 4 | Best performance Award! |
18
-
19
- and you need to convert it to a Long Table Format as following
20
-
21
- | NAM | SKILL | SKILL_RATING | COMMENTS | SKILL_COMMENTS |
22
- | --------------| ----------------------------| --------------| -------------------------| ------------------------------|
23
- | Groucho Marx | ACTING_RATING | 4 | Awesome | ACTING_COMMENTS |
24
- | Groucho Marx | COMEDY_RATING | 3 | Super | COMEDY_COMMENTS |
25
- | Groucho Marx | MUSICAL_PERFORMANCE_RATING | 4 | Really good | MUSICAL_PERFORMANCE_COMMENTS |
26
- | Harpo Marx | ACTING_RATING | 4 | Awesome | ACTING_COMMENTS |
27
- | Harpo Marx | COMEDY_RATING | 4 | Awesome | COMEDY_COMMENTS |
28
- | Harpo Marx | MUSICAL_PERFORMANCE_RATING | 4 | | MUSICAL_PERFORMANCE_COMMENTS |
29
- | Groucho Marx | ACTING_RATING | 4 | | ACTING_COMMENTS |
30
- | Groucho Marx | COMEDY_RATING | 3 | Thumbs up | COMEDY_COMMENTS |
31
- | Groucho Marx | MUSICAL_PERFORMANCE_RATING | 4 | Nice | MUSICAL_PERFORMANCE_COMMENTS |
32
- | Harpo Marx | ACTING_RATING | 4 | Best Acting | ACTING_COMMENTS |
33
- | Harpo Marx | COMEDY_RATING | 4 | Nice | COMEDY_COMMENTS |
34
- | Harpo Marx | MUSICAL_PERFORMANCE_RATING | 4 | Best performance Award! | MUSICAL_PERFORMANCE_COMMENTS |
10
+ Suppose you have a Wide Table format Performance Ratings that you need to covert to a Long Table format:
11
+
12
+ | ![ Copy of Untitled drawing(3)] ( https://github.com/user-attachments/assets/fe058626-62c3-4155-a2aa-288b6c84c798 ) |
13
+ | :--:|
14
+ | Unpivoting to convert Skill Rating and Skill Comments to a Flattened view of the data as Key-value pairs|
35
15
36
16
This can be achieve by using the UNPIVOT function as following
37
17
0 commit comments