-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathQueryFoldingPPS.pq
30 lines (30 loc) · 1.32 KB
/
QueryFoldingPPS.pq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
let
Source = Sql.Databases("localhost"),
AdventureWorksDW2016 = Source{[Name="AdventureWorksDW2016"]}[Data],
dbo_DimEmployee = AdventureWorksDW2016{[Schema="dbo",Item="DimEmployee"]}[Data],
#"Filter: Salesperson = True" = Table.SelectRows(dbo_DimEmployee, each ([SalesPersonFlag] = true)),
#"Custom: Gender Name" = Table.AddColumn(#"Filter: Salesperson = True", "Gender Name", each
if [Gender] = "M"
then "Male"
else if [Gender] = "F"
then "Female"
else null, type text),
#"Custom: Full Name" = Table.AddColumn(#"Custom: Gender Name", "Full Name", each
[FirstName] &
(
if [MiddleName] = null
then " "
else " " & [MiddleName] & " "
)
& [LastName], type text),
#"Removed Other Columns" = Table.SelectColumns(#"Custom: Full Name",{"EmployeeKey", "HireDate", "BirthDate", "EmailAddress", "Phone", "Gender Name", "Full Name"}),
#"Custom: Column Splitter" = Table.TransformColumnNames(#"Removed Other Columns", each
Text.Combine(
Splitter.SplitTextByCharacterTransition(
{"a".."z"},
{"A".."Z"}
)(_)
, " ")
)
in
#"Custom: Column Splitter"