Could not find function allprevious in Tibco Spotfire - spotfire

Im trying to calculate the running sum for a line chart.
The custom expression I'm using is
sum([cost]) OVER (AllPrevious([Axis.X]))
However, I get the error message: could not find function AllPrevious
However this error appears only if I pull the data via SQL/Jdbc. If the data origins from an excel sheet everything works fine.

The problem was that the query only works for in memory data. In-DB data requires the use of 'then', as row level data is not available.
Hence the following statement needs to be used
sum([cost]) then Sum([Value]) OVER (AllPrevious([Axis.X]))

Related

Combining if error with offset for a Dynamic named range in excel?

I am having a situation where i download data from an api (takes a few seconds each time).
Then i use a named range in excel using the following code
=OFFSET(DATA_PER_YEAR!$A$8;COUNTA(DATA_PER_YEAR!$A$8:$A$100)-DATA_PER_YEAR!$H$1;0;DATA_PER_YEAR!$H$1;1)
Where DATA_PER_YEAR!$H$1 is a variable to give the size of the "window" to return. I then use the named range to create plots.
This works very well until I refresh the api and then there is no data in the cells for a few seconds. This gives a lot of error messages, so in order to fix it i tried to wrap a iferror(code,indirect("a8:a9")) but that did not seam to work.
Is there a better/correct way to do this?

Loop through all available OLAP cube filter values

Tried to find a solution here, but was not successful.
I have a pivot table in Excel, which is connected to a data cube. What works is setting filters on values inside the Pivot Table with the code:
ActiveChart.PivotLayout.PivotTable.PivotFields(fieldOrder_two).VisibleItemsList _
= Array(tempArray)
I receive an error message if a value being filtered is not existing - which makes sense.
Is there a way to obtain a list of all available values before setting the filter? It would be nice to populate an array with the ItemsList, but I can't find a ways to "talk" to the itemslist.
Example of the available values:
Edit: I would like to avoid an Error Handling solution, because I would need to perform other checking (Upper/Lower Case) as well probably.

Tracking down the source of a dataformat error in a query

I have a query in Excel, retrieving data from a different workbook. Recently, however, the table the query writes data to has failed with the error DataFormat.Error: Invalid cell value '#N/A'..
Going through the steps of the query in the query editor, it looks like the error happens when some rows used to be sorted out:
I suspect the error is because of a change of some column header in the source file, but I am far from certain if this is actually the case.
Is there any way to track down a more detailed error description, e.g. to get to know what cells it is that has the invalid values? Is there some other way to get a better grip on what is causing the error?
Power Query really doesn't seem to know what to do when it finds an excel error code (#N/A; #REF; etc). Often when working in Power query, there isn't a problem because the row containing the error code isn't actually loaded into the preview data. It isn't until you do an operation like sort, group, remove duplicates, or something that has to read through all the rows in the data set that you run into the problem.
You have to either fix this by using the try functionality in M to handle the error, or fix your source data so that it no longer contains the error code.
If you are sourcing from an Excel Spreadsheet, just after you import the data, before you even Promote Headers or Change Data types select all columns and delete errors.
That worked for me.
I overcame this error by inserting a "Remove Errors" step before Filtering.
if your source is an excel, search for the N/A inside of your workbook for values and replace them with proper values. then it should work.

"XML parsing failed at line xxx, column 36: illegal xml character" when importing to Power Pivot from SSRS report

Excel 2016 (16.0.6965.2076)
SQL Server 2014 (12.0.4213.0)
I have an SSRS report with 10 parameters - two are dates and the other 8 are text dropdowns using a query to populate the options. If I try to fetch this report into a Power Pivot Data Model in Excel (Power Pivot -> Manage -> From Other Sources -> Report), when completing the Table Import Wizard (after successfully specifying my report and parameter values and seeing the report render correctly in the wizard) by clicking on the Finish button on the Select Tables and Views page I receive an error message:
XML parsing failed at line 1345, column 36: Illegal xml character.
The line given varies depending on what parameter values I specify for the report, but the column is always 36. I have inspected my report and these line and column numbers do not appear to relate to my report, as often they are both greater than the total number of rows/columns being returned in the report.
I have looked around online and found a few resources which deal with this issue, but I've been unable to find a solution to my issue:
This blog and this associated Microsoft Connect ticket suggest that I can get this to work by exporting my report as a Data Feed and referencing that from within the Power Pivot wizard instead, but this also doesn't work for me, I get a different error:
Unable to obtain schema for data feed '[Report feed Name]'. Please make sure this feed exists.
I have found suggestions elsewhere online that this subsequent error (or the original problem) may be as a result of the report URL being too long (including parameters/values). Unfortunately I cannot see any further way to reduce the URL length (currently over 700 characters), as I have minimised my parameter names and the report name, but still have this issue (I do not believe I can reduce the parameter values as they are fetched from an application database which we cannot change).
I have also seen suggestions to replace my "Get values from a query" parameters with "Specify values" parameters, but this is not viable as the parameter values must be fetched from the application database mentioned above and will change over time, so need to be fetched dynamically.
Can anyone suggest a solution or further troubleshooting steps I can follow for this issue?
To narrow down your problem, I would export the report (using your parameters) to XML format. This is effectively a manual repro of what Power Pivot is doing when it calls your report.
Then I would open that file in an XML editor (e.g. Visual Studio) and hunt for "line 1345, column 36: Illegal xml character.".
If this is triggered by a textbox name, you can override them for XML export by setting the DataElementName property.
If it is triggered by a data value, I would use an SSRS expression to try to avoid it. You can test for Globals!RenderFormat.Name = "XML" to only manipulate the data value under that scenario.
The first investigation I suggest is trying to rule out the URL issue as a potential cause. For test purposes only, is it possible to copy the report and modify it so that most of the parameters are hard-coded with valid examples? You could then try fetching the report with a much smaller URL, using only one or two parameters.
If the copied report works, confirming that the URL length is the issue, then you have no option but to investigate further possibilities to reduce URL length.
If the URL length is the issue, you could incrementally add parameters to determine a target URL length that operates correctly.
Is it possible to reduce the length of input parameters? If the parameters need to match values of data or code that can't be easily modified, is it possible to modify the report to incorporate a lookup table, so that passed in short variables are mapped to their full versions?
Alternatively, do you have several text parameters with only 2 or 3 options? Or, are there are few parameters which are only valid in specific combinations? If so, it gives you another option, although it's extremely bad practice and will result in a lot of effort to maintain the reports if anything needs to change... You could create several copies of the report, hardcoding the parameters which have a limited number of valid combinations. Then, based on input parameters stored in Excel, you call the relevant report that matches those parameters, and pass through the remaining parameters in the URL.
However, if the URL length is not the issue, you can then put more effort into investigating the cause and hopefully cleaner solutions!
This is what I did.
Used =TRIM(CLEAN( CELLS )) on the entire data, replaced and uploaded.
It accepted.

Excel MATCH function not working with automatic data update

I have an excel function that looks like this:
=MATCH($A3,Table[Column],FALSE)+1
What this function does is return me the row number of the matching row where
table[column] == $A3
and this is working fine in a static file. However as soon as I made the data from Table to automatically update every minute it just stopped working (I get #N/A error as the function return).
After imports/updates to tables and pivot tables, you often need to use the Refresh All button in the data toolbar. That should clear this issue right up! I would even create a VBA macro to call the refresh automatically after every update.
I've also found it's better to use named ranges or dynamic named ranges in situations such as this. Check this out: http://support.microsoft.com/kb/830287

Resources