Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi!
I'm trying to create an If condition in a pipeline that should be true if a table in my DW has more than 0 rows.
I don't know how to query this table from the IF Condition.
I tried to use a lookup before to query the table (count(*) as nr_of_rows from ...) but then I don't know how to access the value nr_of_rows when writing the expression in the if statement. I tried some different variations but nothing seems to work.
The condition in my if is of the form:
Solved! Go to Solution.
Yes that was it. I removed the quotes from the 0 and not it works as expected:
Hi!
Thanks for the suggestion. My setup was close to what you describe, but now I think it is the same:
Lookup:
IF:
Are we sure that we are accessing the number from the lookup and no other part of the string or something, which would make the output not exactly equal to 0?
Hi @JE_test ,
As part of debugging, can you please use a Set Variable and try to see the output of it?
When I tried to repro, it is working perfectly. I can go to true and false branches.
Thanks for the tips with using Set Variable for debugging!
Maybe the problem was that it was comparing an integer to a string and found it to be false. When I try to assign the output to a String I get this error:
The variable 'output' of type 'String' cannot be initialized or updated with value of type 'Integer'. The variable 'output' only supports values of types 'String'.
Yes that was it. I removed the quotes from the 0 and not it works as expected:
Hi @JE_test ,
It was great to know that you were able to get to a resolution . We expect you to keep using this forum and also motivate others to do that same . You can always help other community members by answering to their queries
Hi @JE_test ,
Thanks for using Fabric Community.
As I understand you would like to perform if else operation based on value of count.
Steps to achieve it -
select count(*) as count from api.table4
@not(equals(activity('Lookup1').output.firstRow.count, '0'))
FYI: inorder to understand the loopup activity json output,
After execution of pipeline, you find the below -
Hope this is helpful. Please let me know incase of further queries.