Forum Discussion
Ghost query causing report refresh to fail in service
- 6 years ago
I figured out what was causing the problem. This step in one of my queries:
#"Run Python script" = Python.Execute(" def f(flag): global previous_seq previous_seq = 0 if flag == 0 else previous_seq + 1 return previous_seq previous_seq = 0 dataset['Fiscal Period'] = dataset[['PERIODCODE']].apply(lambda x: f(*x), axis=1) ",[dataset=#"Changed Type"]),What it was doing was numbering the fiscal periods 1-# based on the opening and closing period codes. This allowed me to handle years with <> 12 fiscal periods, but going through the history there was only one year that had 13 periods. So instead, I just filtered the years past that year, created an index column starting with 1, then used Number.Mod([Index], 12) and replaced the 0's with 12. Stuck with only being able to hand years with 12 periods, but at least the refresh is working from the service again. What I don't get is why the query previously worked in the service (albeit through a personal gateway rather than my enterprise), and suddenly stopped when that query hasn't been changed since I first wrote it. Ah well, such is life 🙂 Thanks for your help!
Sorry for the delay, busy day at work today. I went through all the other existing queries' M code and I don't see a reference to a Query1. I copy pasted every one into Notepad++ and went through looking for any references to "Query". As far as I can tell everything looks fine ?
I figured out what was causing the problem. This step in one of my queries:
#"Run Python script" = Python.Execute("
def f(flag):
global previous_seq
previous_seq = 0 if flag == 0 else previous_seq + 1
return previous_seq
previous_seq = 0
dataset['Fiscal Period'] = dataset[['PERIODCODE']].apply(lambda x: f(*x), axis=1)
",[dataset=#"Changed Type"]),
What it was doing was numbering the fiscal periods 1-# based on the opening and closing period codes. This allowed me to handle years with <> 12 fiscal periods, but going through the history there was only one year that had 13 periods. So instead, I just filtered the years past that year, created an index column starting with 1, then used Number.Mod([Index], 12) and replaced the 0's with 12. Stuck with only being able to hand years with 12 periods, but at least the refresh is working from the service again. What I don't get is why the query previously worked in the service (albeit through a personal gateway rather than my enterprise), and suddenly stopped when that query hasn't been changed since I first wrote it. Ah well, such is life 🙂 Thanks for your help!