How to obtain a list of all cube's translations? - sql

I want to get a list of meta-data translations for our cube (measure groups + dimensions).
I've tried a MDX query in Management Studio:
SELECT *
FROM $system.MDSchema_hierarchies
WHERE [CUBE_NAME] ='DWH OLAP'
But can't see there any translation column. Any help would be appreciated. Thanks in advance.

Unfortunately, there is no Translation information at SSAS Management Views. You have to use Microsoft AMO for that, writing a program on .NET. Please find a code sample doing almost your task, and Microsoft Documentation on AMO.

Related

JOIN with a dataset

I am very new to Superset and SQL in general, please excuse my poor language as well.
General question: How do I use an existing superset dataset in a sql query?
Case: I am trying to create a map based on german postal codes. Therefor I need to join that table with a translation table containing german postal code to JSON coordinates. The translation table is in another database than the german postal codes are. I am constantly trying to JOIN these both together, but it does not work. I assume you can only work with the data from one single database at once. Is it possible to create datasets with the needed data and reuse these datasets in a sql query? I tried this, but I dont know how to access these. When using data on a database I would write:
Select * from database.table
To access a superset dataset in my query:
Select * from dataset (how it is named in the superset dataset list)
which does not work at all.
I am desperatly trying to solve this problem but I am just not able to.
Thanks for your help in advance.
In Superset's SQL Lab, you can run pretty much any valid SQL query that your database accepts. The query will more / less be sent to your database and the results displayed to you in the results panel. So you can run JOIN queries in SQL Lab, for example.
If you want to visualize data from the results of a SQL Query, hit the "Explore" button after running the query. Then, you'll be asked to publish the query you wrote & ran as a Virtual Dataset. Finally, you'll be taken to the Explore, no-code chart builder to visualize your data.
I wrote a bit more about the semantic layer in Superset here, if you'd like to learn more: https://preset.io/blog/understanding-superset-semantic-layer/

Which function can I use to find AVERAGE of a set of numbers in SQL?

I am very new to SQL and I am still trying to understand it. I was trying to find the average of a set of numbers but I don't know which function to use. In the SELECT statement , I wrote SELECT AVG as was written in the example I was working on and it returned error message 'Table Not Found'.
From the error message you gave, I think you have misunderstood how the avg keyword works.
Select avg(<the value you want to check the average of>)
FROM <table name here>;
Example
SELECT AVG(Price)
FROM Products;
Please note
As the comments on your threat states, please provide us with what SQL database you are using. Are you using PostgresSQL, mysql etc. Different SQL databases have different features and I can be helpful for us to know what you are using 😊
Also, if you can provide us with the information on the table (which fields the table contains) we can provide you with a more specific SQL query 😊
Here is a great tutorial that might help you further!
https://www.w3schools.com/sql/sql_count_avg_sum.asp
Hope this helps 😊

Is there a way to convert this MDX syntax to DAX?

I'm changing a legacy multidimensional analysis services to tabular and "Converting" the MDX measures to DAX. (I don't have much knowledge using MDX)
I found the script below and i'm not sure what it is doing.
([Origin].[Origin].&[BUDGET FILE],[Measures].[Value])
I think it's is using the Column Value inside the Budget file located in the Origin to fill or create something in the measures.
So, first can anyone help me understand what this code is doing?
And second, would DAX support such thing?
Thanks!
Here is the equivalent assuming the Value measure is a Sum.
CALCULATE(SUM(YourTableName[Value]), 'Origin'[Origin]="BUDGET FILE")

How can I find out the datatype of measures in MDX?

I am new to Microsoft SQL Server Analysis Services and MDX.
How can I find out the datatype of measures in MDX?
The measures I am trying to find the datatype for are defined using a WITH clause which as I understand means that it is possible for each measure to have multiple datatypes.
How about the TypeName function:
WITH
Member [Measures].[My Type] as
TypeName([Measures].[My Other Measure])
Etc...
You are correct that each cell can be a different type of you have a calculations.
You need to look via BIDS or Visual Studio.
Use the link provided by #arunbabu :
http://beyondrelational.com/modules/12/tutorials/799/tutorials/17951/getting-started-with-ssas-multidimensional-part-7-creating-measures-in-ssas.aspx
Also long-time scholar on analysis services William Pearson has many helpful articles. Here is one about member properties:
http://www.databasejournal.com/features/mssql/article.php/3770686/Intrinsic-Member-Properties-The-MEMBERVALUE-Property.htm
A full catalog of his articles on Database journal is here:
http://www.databasejournal.com/article.php/1459531

Quickly navigate through data with SQL Management Studio

I'm a developer who works a lot in an environment with lots of FK relations.
When I'm developing my application, I would like the ability to quickly navigate through data.
I'll explain it through an example :)
Table - Car
ID TypeID CarName ...
1 1 A
2 1 B
3 2 C
I would get this data if I did a "SELECT * FROM car". The problem is that I only get a limit amount of data. I don't know which Type Car A is, I only know its TypeID.
How I handle this now, is by either writing an extended SQL query (inner join it with type and also include the name) or by doing a SELECT * FROM type where ID = 1.
I'd like to be able to have this data presented to me quickly (and I'm not talking about a regular view). I would like to write an extension on SQL management studio, in which I would check if the table had a FK-relation. If it's filled in, I'd then give a tooltip if I hover over the FK-cell.
The question: is this possible? Can I write extensions on SQL Management studio? Does something like this already exist within SQL Mang studio or any third party packages?
If it doesn't exist, but I can make it, how would I go about doing it?
Thanks for the help :)
LINQPad is a c# scratchpad that speaks LINQ2SQL.
I use it a lot to query data.
You can quite easily mix LINQ2SQL and c# code to do more advanced queries and calculations than possible in plain SQL.
The free version works OK, but if you pay you get autocompletion too.