Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Is it possible to create a custom column with a series of if statements that produce a concatenated string? I have done this in Excel but can't recreate it in power query for a custom column. My excel text is as follows:
=IF([@[Customer Survey Status]] ="Completed", 1,(IF(Customer Survey Status="In Review",1,0))) & "," & IF([@[Partner Survey Status]]="Completed", 1,(IF([@[Partner Survey Status]]="In Review",1,0))) & "," & IF([@[Document Status]]="Completed",1,(IF([@[Document Status]]="In Review",1,0))) & "," & IF([@[Invoice Status]]="Completed",1,(IF([@[Invoice Status]]="In Review",1,0)))
I've tried the If statement and the text.contains methods but can't get either to work.
Result desired is something like 0,1, 0,1
I did post a 30 minutes ago but can't see it in the forums so reposting, sorry if this is a duplicate.
Thanks!
Solved! Go to Solution.
You can pretty much directly translate this into Power Query code. There are no brackets for if ... then ... else but the rest is nearly the same.
Something like
=Table.AddColumn(#"Previous Step", each
(if [Customer Survey Status] ="Completed" or [Customer Survey Status]="In Review"
then "1," else "0,") &
(if [Partner Survey Status]="Completed" or [Partner Survey Status]="In Review"
then "1," else "0,") &
(if [Document Status]="Completed" or [Document Status]="In Review"
then "1," else "0,") &
(if [Invoice Status]="Completed" or [Invoice Status]="In Review"
then "1" else "0")
)
Or if you want to use List.Contains:
=Table.AddColumn(#"Previous Step", each
let l = {"Completed","In Review"}
in
(if List.Contains(l,[Customer Survey Status] then "1," else "0,") &
(if List.Contains(l,[Partner Survey Status] then "1," else "0,") &
(if List.Contains(l,[Document Status] then "1," else "0,") &
(if List.Contains(l,[Invoice Status] then "1" else "0")
)
You can pretty much directly translate this into Power Query code. There are no brackets for if ... then ... else but the rest is nearly the same.
Something like
=Table.AddColumn(#"Previous Step", each
(if [Customer Survey Status] ="Completed" or [Customer Survey Status]="In Review"
then "1," else "0,") &
(if [Partner Survey Status]="Completed" or [Partner Survey Status]="In Review"
then "1," else "0,") &
(if [Document Status]="Completed" or [Document Status]="In Review"
then "1," else "0,") &
(if [Invoice Status]="Completed" or [Invoice Status]="In Review"
then "1" else "0")
)
Or if you want to use List.Contains:
=Table.AddColumn(#"Previous Step", each
let l = {"Completed","In Review"}
in
(if List.Contains(l,[Customer Survey Status] then "1," else "0,") &
(if List.Contains(l,[Partner Survey Status] then "1," else "0,") &
(if List.Contains(l,[Document Status] then "1," else "0,") &
(if List.Contains(l,[Invoice Status] then "1" else "0")
)
Thanks so much, this really helped!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
81 | |
75 | |
60 | |
37 | |
33 |
User | Count |
---|---|
102 | |
56 | |
52 | |
46 | |
40 |