Hi everybody!
I have looked all over the internet, and found chunks of information, but havent had success in using these infos in my querys.
So my problem is:
1. I have 3 Querys which do almost the same thing, but with little differences.
2. I wanna sum these 3 queries up in one query with an IF statement.
3. The IF statement gets the data from the first command of the query, and after that command the IF statement comes in the second command.
4. The rest of the code should be in the IF statement.
Here is my code:
Can you help me in this situation? What is the proper syntax?
I have looked all over the internet, and found chunks of information, but havent had success in using these infos in my querys.
So my problem is:
1. I have 3 Querys which do almost the same thing, but with little differences.
2. I wanna sum these 3 queries up in one query with an IF statement.
3. The IF statement gets the data from the first command of the query, and after that command the IF statement comes in the second command.
4. The rest of the code should be in the IF statement.
Here is my code:
Code:
let
Source = Folder.Files("..."),
First command = Table.AddColumn(Source, "Service Provider", each if List.Count(List.FindText(Text.Split([Folder Path],"\"),"Vodafone")) >0 then "Vodafone" else if List.Count(List.FindText(Text.Split([Folder Path],"\"),"T-Mobile")) >0 then "T-Mobile" else ""),
The IF command = if [Service Provider] = "Vodafone" then /[B]/here should come the magic
//the following commands should be in the true branch of the IF statement[/B]
FILTER files = Table.SelectRows(The IF command, each Text.Contains([Name], "...") and ([Extension] = ".csv")),
ADD COLUMN1 = Table.AddColumn(FILTER files, "Date", each Date.FromText(Text.Start(Text.End([Folder Path],7),4)&"."&Text.Start(Text.End([Folder Path],3),2)&".01"), type date),
ADD COLUMN2 = Table.AddColumn(ADD COLUMN1", "Year", each Date.Year([Date])),
in
ADD COLUMN2
[B]//here comes the else branch
[/B]else
ADD COLUMN1 = Table.AddColumn(FILTER files, "Date", each Date.FromText(Text.Start(Text.End([Folder Path],7),4)&"."&Text.Start(Text.End([Folder Path],3),2)&".01"), type date),
ADD COLUMN2 = Table.AddColumn(ADD COLUMN1", "Year", each Date.Year([Date])),
in
ADD COLUMN2
Can you help me in this situation? What is the proper syntax?