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
(APIInsightsID as text)=>
(Counter as number)=>
let
Source = Excel.CurrentWorkbook(){[Name="Table23"]}[Content],
ID = Table.TransformColumnTypes(Source,{"App Insight ID ", type text}),
APIInsightsID = "",
Counter = 1,
if Counter > ID.RowCount
then APIInsightsID,
else
if ID."App Insight ID " != APIInsightsID
then
Counter+=1,
APIInsightsID = ID."App Insight ID ",
@CheckAPI
in
ID
Hello everyone I'm new in writing power queries, and I don't know why I get this error before if condition, do anyone know why? Kind regards Branislav
I want to iterate through a column, because while simply don't work, while is unrecognizable command.
Hi @Anonymous ,
You need to assign the IF statement to a variable. And in your code, the red circles are not recognized by PowerQuery.
Since I'm not sure of the exact output you want to achieve, I've only created a code that can be executed.
(APIInsightsID as text)=>
(Counter as number)=>
let
Source = Table,
ID = Table.TransformColumnTypes(Source,{"App Insight ID ", type text}),
APIInsightsID = "",
Counter = 1,
condition = if Counter > ID[Index]{0} then APIInsightsID
else if ID[App Insight ID] <> APIInsightsID then Counter+1
else APIInsightsID = ID[App Insight ID]
in
condition
Best Regards,
Winniz
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 10 | |
| 6 | |
| 5 | |
| 4 | |
| 3 |