MDX Using Member_Key - mdx

I'm trying to write a query which uses order in the Pentaho Schema Workbench program.
A simple query I pulled from Saiku analysis's GUI runs without issue.
Trying to add in an order yields the message "No function matches signature '.Member_Key'"
How would I got about debugging this? All the examples I see online for ordering data use CurrentMember and Member_Key so I'm a little lost.

These are the properties:
https://msdn.microsoft.com/en-us/library/ms145528.aspx?f=255&MSPPError=-2147217396
Try MEMBER_VALUE instead of the key.
Also try without the underscore as MEMBERVALUE

I found this page online which shows how to access intrinsic properties through Mondrian MDX.
Instead of [DimTime.CalendarYearMonth].CurrentMember.MEMBER_KEY you write [DimTime.CalendarYearMonth].CurrentMember.Properties("MEMBER_KEY")

Related

How to pass a Date Pipeline Parameter to a Data Flow use in a Dataflow Expression Builder

I am doing something that seems like it should be very easy yet I have yet to figure this out. I have read countless posts and tried everything I can think of and still no success.
Here goes:
I created a Pipeline Parameter pplLastWritten with a default value of 2022-08-20 12:19:08 (I have tried without the time for troubleshooting and still get errors)
Then I create a Data Flow Parameter ptblTableName
I have tried to convert to a Date, keeping as is and converting later...you name it still errors out.
In the expression builder I tried this and many more ways to build out to a sql statement:
"SELECT * FROM xxxxxx."+$ptblTableName+"where Lastwritten>='{$ptblLastWritten}'"
This is the post I got the idea from: ADF data flow concat expression with single quote
This is the error I got most of the time.
Operation on target df_DynamicSelect failed: {"StatusCode":"DF-Executor-StoreIsNotDefined","Message":"Job failed due to reason: at Source 'RptDBTEST'(Line 5/Col 0): The store configuration is not defined. This error is potentially caused by invalid parameter assignment in the pipeline.","Details":""}
I have tried so many things but in the end nothing has worked. I am new to Data Factory and come from the SSIS world which was so much easier. I would greatly appreciate someone helping. Please explain this like I'm a kindergartener because this tool is making me feel like it. :) Thank you in advanced.
I have tried various ways to format
Using different ideas in the expression builder
the ideas in this post: ADF data flow concat expression with single quote
You can use concat() function in the Data flow dynamic expression like below.
Here is the sample data in SQL.
I have created two dataflow parameters mytable and mydate.
Passed the values like below. Check the expression checkbox. For date you can also pass like this '2022-11-07T00:00:00.0000000'.
In the Query option use below Expression.
concat('select * from dbo.',$table_name,' where mydate >=','\'',$mydate,'\'')
Values inserted in Target table.

How do I query a specific range of Firebase's analytics table using Data Studio's date parameters?

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).

BigQuery DATE_DIFF Error: Encountered " <STRING_LITERAL>

I'm trying the following query from the BigQuery Standard SQL documentation:
SELECT DATE_DIFF(DATE '2010-07-07', DATE '2008-12-25', DAY) as days_diff;
https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#date_diff
However, I'm receiving the following error from the UI:
Error: Encountered " "\'2010-07-07\' "" at line 1, column 23. Was expecting: ")" ... [Try using standard SQL (https://cloud.google.com/bigquery/docs/reference/standard-sql/enabling-standard-sql)]
This is a simple copy and paste from the doc into the web UI Query Editor.
Any idea on how to resolve this?
Below are examples for respectively BigQuery Legacy SQL and Standard SQL
Make sure you try code as it is in answer below - not just second lines but 2(both) lines including first line that looks like comment - but in reality important part of query as it controls which SQL dialect will be in effect!
#legacySQL
SELECT DATEDIFF(DATE('2010-07-07'), DATE('2008-12-25')) AS days_diff
and
#standardSQL
SELECT DATE_DIFF(DATE '2010-07-07', DATE '2008-12-25', DAY) AS days_diff
both returns result as below
Row days_diff
1 559
Ideally, you should consider migrating to Standard SQL
Although the answer has already been provided in the comments to your questions and by Mikhail in the other answer, let me share with you a complete answer that hopefully addresses all your doubts:
ERROR MESSAGE
As explained in the error message you are getting, [Try using standard SQL (...)]. You are trying to run this sample using Legacy SQL (which instead would use the DATEDIFF function). You are actually right, you are running the exact same query provided in the documentation, but the issue here is that the documentation you are using is for Standard SQL (the preferred query language in BigQuery), but you are instead using Legacy SQL (the default language in the old UI, the one you are using).
CHANGE THE QUERY LANGUAGE IN USE
First of all, I would like to remark the importance of using Standard SQL instead of Legacy SQL, as the former adds new functionalities and is the current recommended language to use with BigQuery. You can see the whole list of comparisons in the documentation, but if you are starting with BigQuery, I would just go straight away with Standard SQL.
Now, that being clarified, in order to use Standard SQL instead of Legacy SQL, you can have a look at the documentation here, but let me summarize the available options for you:
In the BigQuery UI, you can toggle the Use legacy SQL option inside
the Show options menu. If this option is marked, you will be using
Legacy SQL; and if it is not, you will be using Standard SQL.
You can use a prefix in your query, like #standardSQL or #legacySQL, which would ignore the default configuration and use the language you specify with this option. As an example on how to use it, please have a look at the other answer by Mikhail, who shared with you a couple of examples using prefixes to identify the language in use. You should copy the complete query (including the prefix) in the UI, and you will see that it works successfully.
Finally, as suggested by Elliott, you can use the new UI, which has just recently released in Beta access. You can access it through this link https://console.cloud.google.com/bigquery instead of the old link https://bigquery.cloud.google.com that you were using until now. You can find more information about the new BigQuery Web UI in this other linked page too.

How to save a view in BigQuery - Standard SQL Dialect

I am trying to save a view using BigQuery's WebUI, which was created in Standard SQL Dialect, but I am getting this error:
Failed to save view. Bad table reference "myDataset.myTable"; table references in standard SQL views require explicit project IDs
Why is this error showing up? How can I fix it? Should the "Table ID" field of the "Save view" dialog include the project id? Or does this error appear because of the query itself? Just in case, the query is running without any problems.
Thanks for your help.
Your view has reference to myDataset.myTable - which is ok when you just run it as a query (for example in Web UI).
But to save it as a view you must fully qualify that reference as below
myProject.myDataset.myTable
So, just add project to that reference
Same reply, in other words
The issue is in this part of query: FROM com.table
When running query, it's fine to not fully specify the name of table like this:
com_company_app_beta_IOS.app_events_20180619
But to save the query as a view the FROM has to be like this:
`company-prod`.com_company_app_beta_IOS.app_events_20180619
You need the backticks around the `company-prod` because the - dash character is unsupported in object names.
The structure in BigQuery look like this:
bigquery ui
I had the same problem.
You'll need to use backticks around the the whole string project.dataset.view/table in both create and select statements:
create view company-prod.com_company_app_beta_IOS.YOUR_VIEW as
select * from company-prod.com_company_app_beta_IOS.app_events_20180619
Use backticks around string project.dataset.view

SQL Reporting 2008 and Excel as Data Source

I am working on a project were we need to develop SQL Reports based on some excel files.
I was able to create the ODBC for the Excel file and I was able to connect to it successfully using the Report Services.
My question is:
How can I used paramaters in the query ? When I try to use #CIF or #StartDate I get all kinds of errors and I don't know how to use parameters with SQL query for Excel.
Sample:
SELECT * FROM [Loans$] Where [CIF] = #CIF
Can anyone tell me how?
If you are successfully extracting information without trying to filter at the query level, as a workaround you can add the filtering at the DataSet level, something like:
This will extract data from the DataSet then apply any filter, not try to do it at the same time.
It's might not be addressing your root cause, but will hopefully get you up and running in the meantime.
Since you don't actually list the errors you're getting, it's hard to offer more specific advice.