I am bit new to mdx . Thing is we want to fetch data from olap cube between two dates.The date format is yyyy-MM-dd.So please suggest me on how to use timestamp range to filter out data.
I am using this query-
SELECT
NON EMPTY {[Measures].[Keyword count]} ON COLUMNS,
NON EMPTY {Hierarchize({[keyword].[keyword].Members})} ON ROWS
FROM [Basicsearch]
WHERE CrossJoin({[Path].[/Search]}, {[Timestamp].[${styear}].[${stmonth}].[${stday}]: [Timestamp].[${eyear}].[${emonth}].[${eday}]})
but it is not giving any result and no error also.
please suggest me how to run this query
Enable SQL Logging ( look at the commented out mondrian settings in log4j.xml ) and clear the cache. Then run the MDX query and look at the SQL logs to see what SQL mondrian has generated. You'll be able to tell from that why there is no data!
Could be many things - bug in the schema, genuinely no data, or problem with the parameters.
Related
I am currently working on a project of replacing our old access database queries, but on one of them I am not able to view the actual SQL View.
Does anyone know a way to force the view or to export it somehow?
Error causing problem:
The SQL statement could not be executed because it contains ambiguous outer joins.
Note that I can view the Design View without issue but when I right click on the tab and select SQL View is when I get the error.
I did attempt what #LeeMac mentioned below but same error occurs:
EDIT:
This question is not like Ambiguous Outer Joins?
The OP on that question can actually see and edit their SQL.
My issues is that I cannot see or edit the SQL as the SQL View wont open.
Try executing the following VBA code from the Immediate Window (accessible using Ctrl+G) in the VBA IDE (open the IDE using Alt+F11):
?CurrentDb.QueryDefs("YourQuery").SQL
Replace YourQuery with the name of your query.
This should print the SQL code which comprises your query - you can then analyse the SQL to determine the cause of the error.
It's odd this error would arise when merely viewing the SQL content of the query definition.
It makes me think that the query is perhaps referencing a crosstab subquery which is actually the cause of the error, but which needs to be evaluated in order for MS Access to determine the columns available when viewing the design of the query in question.
Try this:
hit ctrl-g, and from immediate window type in this:
saveastext acQuery,"Name of query","c:\test\mysql.txt"
Access ordinarily doesn't allow you to save invalid queries, so it's strange you somehow got into this situation in the first place.
If you can copy the query, you can easily get to the SQL by changing the query to a passthrough query, either through the GUI or through VBA:
Dim q As DAO.QueryDef
Set q = CurrentDb.QueryDefs!Query1
q.Connect = "ODBC;"
Debug.Print q.SQL
Passthrough queries are not validated, so you can freely read and write anything you want as SQL in it.
Note that this is irreversible when done through VBA. You can only change it back to a normal query once you made the SQL valid again. If you do it through the GUI, you can just not save it, though.
I had this problem and the issue was that i had a subquery that calculated fields but did not actually have a table in it. for example it would calculate first and last day of last month which is 2 calculated fields, then it was the first query in a series of queries that were built off it and the last one wouldnt resolve sql as original poster indicated also gave the ambiguous join message as well as query needs input table (which was that first subquery). i put a table with 1 record in it but didnt use the record and it worked.... so it just a needs a table in it.
I've been reading up on how to query a wildcard table in BigQuery, but Data Studio doesn't seem to recognize the _TABLE_SUFFIX keyword.
Google Data Studio on using parameters
Google BigQuery docs on querying wildcard tables
I'm trying to use the recently added date parameters for a custom query in Data Studio. The goal is to prevent the custom query from scanning all partitions to save time.
When using the following query:
SELECT
*
FROM
`project-name.analytics_196324132.events_*`
WHERE
_TABLE_SUFFIX BETWEEN DS_START_DATE AND DS_END_DATE
I receive the following error:
Unrecognized name: _TABLE_SUFFIX
I expected the suffix keyword to be recognized so that the custom query is more efficient. But I get this error message. Does Data Studio not yet support this? Or is there another way?
It could be possible that you are setting the query in the wrong place. I created a DataSource from a Custom Query and the wildcard worked. The query I tested was the following, similar to yours since _TABLE_SUFFIX is a wildcard that is available in standardSQL in BigQuery:
select
*
from
`training_project.training_dataset.table1_*`
where
_TABLE_SUFFIX BETWEEN '20190625' AND '20190626'
As per your comments you are trying to add a query in the formula field of a custom parameter, however the formula field only accepts basic math operations, functions, and branching logic.
The workaround I can see is to build a select query and use it as a Custom Query in the Data Source definition so that the query can calculate any extra fields in advance (steps 5,6 and 7 from this tutorial).
I have a query that uses
row_number() over(partition by a,b)
When I run the query in dbvisualizer, it runs fine. When I try to use it as a custom SQL query in Tableau, it throws the error:
Error 3537: Incorrect number of parameters for prepared statement _PLAN000011EBDD67590_42
Any idea what I should do? I need my data partitioned by both a and b but Tableau just isn't happy with it.
It's very probably not the ROW_NUMBER() function that perplexes Tableau.
"Incorrect number of parameters" usually means that you have a different number of parameter markers in a query that contains for example WHERE purchase_date = ?, and you maybe try to pass two values in a filter of your report.
I would check for the query that Tableau wants to send in detail, and look at the filter you are using to find inconsistencies .
I faced a situation and also searched for it in the internet but could not be able to get any solution.
Problem
My sql server table has 15000 records. It has several columns.
Among all the records, the 'Email ID' column of one record is storing value along with an unidentified character at the beginning. (Please refer to picture attached)
What I want
I want to get rid of that character using sql query. I am using sql server 2012 version.
I tried with 'replace()' and 'patindex()'. I even tried 'stuff' function.
But, its not working. Instead, when I am fetching the data using query, it is showing that typical character.
Please help me with some ideas. If I need to do some settings in database or table, I am ready for that.
Thanks.
I have a requirement where columns of the SQL will be generated based some selection, these columns are coming from Metric dimension but there is no metric ID present in Fact table.
SQL would be something like below:
SELECT Location_Nbr, Day_Nbr, (Column_List- Coming from some other query)
FROM (Table_Name - Coming from same query which is providing Columns to be selected)
I tried creating the SQL query but I get an error saying there is not a business relation between these tables. Is there any other way to achieve this?
To use Dynamic SQL in Pentaho Report Designer, you need to use
custom jdbc connection in data source
then in master report query name, select message format
type your dynamic query in message Pattern
select
$(dynamic_data) as 'data' from table_name;