Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all
I am doing nested ifs with power query, is there a limit for 2 if statements? I am getting an error when i do more than 2:
if [#"[ Container Material ]"] = "Plastic" then "PET" else
if [#"[ Container Material ]"] = "Glass" then "GLASS"
if [#"[ Container Material ]"] = "Aluminium" then "CAN"
if [#"[ Container Material ]"] = "Flexible Laminate" then "TETRA"
else null
But if do 2 I get no error:
How can I ger right the first image ?
Thanks!
Solved! Go to Solution.
Hi @o59393 ,
I am not sure what you are trying to achieve but your syntax is incorrect. I've typed in bold the missing part in the below formula:
if [#"[ Container Material ]"] = "Plastic" then "PET" else
if [#"[ Container Material ]"] = "Glass" then "GLASS" else
if [#"[ Container Material ]"] = "Aluminium" then "CAN" else
if [#"[ Container Material ]"] = "Flexible Laminate" then "TETRA"
else null
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Hi @o59393 ,
I am not sure what you are trying to achieve but your syntax is incorrect. I've typed in bold the missing part in the below formula:
if [#"[ Container Material ]"] = "Plastic" then "PET" else
if [#"[ Container Material ]"] = "Glass" then "GLASS" else
if [#"[ Container Material ]"] = "Aluminium" then "CAN" else
if [#"[ Container Material ]"] = "Flexible Laminate" then "TETRA"
else null
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 66 | |
| 47 | |
| 43 | |
| 26 | |
| 19 |
| User | Count |
|---|---|
| 196 | |
| 127 | |
| 102 | |
| 67 | |
| 49 |