Forum Discussion

FredLEGUEN's avatar
FredLEGUEN
Icon for Helper III rankHelper III
4 years ago
Solved

If test is true, then run a specific query

Hi group,

I have written a Power Query project to merge different files from different folders.

I'm facing an issue if one of the folders is empty.

For each folder, I have done 2 queries

  • The first query connect to the folder
  • The second execute the steps for the files

I would like to do a test before the second query like this

not(Table.IsEmpty(previousquery))

 

The test works but I just don't know how to write my query if the test returns true or false

 

Any idea?

  • Hi,

     

    Finally, I have found the way to write my condition and the 2 branches

    let
        Source = if not(Table.IsEmpty(Query2)) then
            Table.Combine({Query1, Query2})
        else 
            Query1,

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    = if not(Table.IsEmpty(previousquery)) then QueryName else OtherQueryName

     

    --Nate

  • Hi,

     

    Finally, I have found the way to write my condition and the 2 branches

    let
        Source = if not(Table.IsEmpty(Query2)) then
            Table.Combine({Query1, Query2})
        else 
            Query1,