This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Good day,
I have built a custom connector in visual studio to connect to a custom datasource. I am however struggle adding and IF statement in the function as I see that it indicates an error when I add one. Here is a simple code snipt of that I am trying to do.
Connect = (url as text, count as number) =>
let
If count< 1 then samplecount = 1 else samplecount= count,
response = Json.Document( Web.Contents(url, [ samplecount]))
in
response;
I am not sure if it is a limitation of the PowerBI connector SDK or I am not following the examples online correctly. Please share same insight if possible.
Solved! Go to Solution.
Hi @Bokangmaela
Try changing the first statement into below:
samplecount = If count < 1 then 1 else count,
The second statement also has an error. Web.Contents function expects to have a record parameter after the url. The samplecount should be passed to a valid field in the record. Web.Contents - PowerQuery M | Microsoft Learn
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @Bokangmaela
Try changing the first statement into below:
samplecount = If count < 1 then 1 else count,
The second statement also has an error. Web.Contents function expects to have a record parameter after the url. The samplecount should be passed to a valid field in the record. Web.Contents - PowerQuery M | Microsoft Learn
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
That worked, thanks a lot!
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 35 | |
| 27 | |
| 26 | |
| 22 | |
| 18 |
| User | Count |
|---|---|
| 67 | |
| 36 | |
| 32 | |
| 25 | |
| 25 |