Forum Discussion
Only show visual if there is data
- 5 years ago
Anonymous You will need to modify your query so that if the API returns "null" that you still return a table with the columns. This should fix your data refresh issue as well as well as your visuals issue, something along the lines of:
let Source = <some api call> NextStep = if Source = null then Table.FromRecords( ... ) else Source <rest of your steps> in <last step>
Anonymous You will need to modify your query so that if the API returns "null" that you still return a table with the columns. This should fix your data refresh issue as well as well as your visuals issue, something along the lines of:
let
Source = <some api call>
NextStep = if Source = null then Table.FromRecords( ... ) else Source
<rest of your steps>
in
<last step>Greg_Deckler Thank you for your quick reply. I have now implemented the conditional part to the code. It is working in cases where there are events present, but when there are no events it gives the following error:
"The name 'col1' is already used for a column on table 'Query1'. Choose a different name."
Could it be because this part is considered a separate table? I would have thought that the condition would mean only one of the tables would ever exist at the same time, but the error persists.
Table.FromRecords( ... )
I can see in power query that both cases with and without events is working properly, producing a filled and an empty table respectively. The error appears only when I press close&apply.
- Greg_Deckler5 years ago
Community Champion
Anonymous Is it possible to share the code from Advanced Editor, probably don't need all of it. I need to see how I can test this.
- Anonymous5 years agoNot applicable
Greg_Deckler Turns out the problem was caused by some unrelated spagetti code, and I was able to get it working using your solution. Thank you for your help!