### Setup and Start Session Trace
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/amo/programming-amo-complementary-classes-and-methods.md
This snippet demonstrates how to set up event handlers for session traces and start a trace to monitor current server activities. It includes processing a database and cube, with event handlers outputting trace information to the console.
```csharp
static public void TestSessionTraces(Server svr)
{
// Start the default trace
svr.SessionTrace.OnEvent
+= new TraceEventHandler(DefaultTrace_OnEvent);
svr.SessionTrace.Stopped
+= new TraceStoppedEventHandler(DefaultTrace_Stopped);
svr.SessionTrace.Start();
// Process the databases
// The trace handlers will output all progress notifications
// to the console
Database db = svr.Databases.FindByName("Adventure Works DW Multidimensional 2012");
Cube cube = db.Cubes.FindByName("Adventure Works");
cube.Process(ProcessType.ProcessFull);
// Stop the default trace
svr.SessionTrace.Stop();
}
static public void DefaultTrace_OnEvent(object sender, TraceEventArgs e)
{
Console.WriteLine("{0}", e.TextData);
}
static public void DefaultTrace_Stopped(ITrace sender, TraceStoppedEventArgs e)
{
switch (e.StopCause)
{
case TraceStopCause.StoppedByUser:
case TraceStopCause.Finished:
Console.WriteLine("Processing completed successfully");
break;
case TraceStopCause.StoppedByException:
Console.WriteLine("Processing failed: {0}",
e.Exception.Message);
break;
}
}
```
--------------------------------
### Command-line Installation with Logging
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/instances/install-windows/install-or-uninstall-the-power-pivot-for-sharepoint-add-in-sharepoint-2013.md
This command installs spPowerPivot.msi and creates a verbose installation log file. Ensure the directory for the log file exists.
```cmd
Msiexec.exe /i SpPowerPivot.msi /L v c:\test\Install_Log.txt
```
--------------------------------
### Command Line Installation with Logging
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/instances/install-windows/install-or-uninstall-the-power-pivot-for-sharepoint-add-in-sharepoint-2016.md
This command installs spPowerPivot16.msi and creates a verbose installation log file. Ensure the directory for the log file exists.
```cmd
Msiexec.exe /i spPowerPivot16.msi /L v c:\test\Install_Log.txt
```
--------------------------------
### Example Server Name
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/azure-analysis-services/analysis-services-async-refresh.md
An example of how a server name is constructed for a specific Azure region and server instance.
```plaintext
asazure://westus.asazure.windows.net/myserver
```
--------------------------------
### Create Subcube Example
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/multidimensional-models/mdx/building-subcubes-in-mdx-mdx.md
This example creates a subcube named 'Budget' that restricts the original 'Budget' cube to only accounts 4200 and 4300.
```mdx
CREATE SUBCUBE Budget AS SELECT {[Account].[Account].&[4200], [Account].[Account].&[4300] } ON 0 FROM Budget
```
--------------------------------
### Example Reporting Action URL
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/multidimensional-models/actions-in-multidimensional-models.md
An example of a complete URL for a reporting action, demonstrating how to specify the report server, command, and parameters.
```text
http://localhost/ReportServer/Sales/YearlySalesByCategory?rs:Command=Render&Region=West
```
--------------------------------
### Quiet Installation
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/instances/install-windows/install-or-uninstall-the-power-pivot-for-sharepoint-add-in-sharepoint-2013.md
Use this command for a silent installation that does not display any dialogs or warnings. This is useful for scripting.
```bash
Msiexec.exe /i spPowerPivot.msi /q
```
--------------------------------
### Command-line Installation of Power Pivot for SharePoint
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/instances/install-windows/install-or-uninstall-the-power-pivot-for-sharepoint-add-in-sharepoint-2013.md
Use this command to install spPowerPivot.msi from the command line with administrative privileges.
```cmd
Msiexec.exe /i SpPowerPivot.msi
```
--------------------------------
### Example SQL Query for Partition
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/assl/data-type/tablebinding-data-type-assl.md
Illustrates an effective SQL query generated for a partition, demonstrating how table bindings and filters are applied. This example shows a specific partition 'Sales97' with a date filter.
```sql
SELECT Date, Product ID, Qty, Price, Qty * Price AS Amount
FROM Sales97 As Sales
WHERE Year(Sales.Date) = 97
```
--------------------------------
### Restore Database Example
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/tmsl/restore-command-tmsl.md
An example of the Restore command used to restore a database from a local backup file. It specifies the database name, file path, overwrite setting, password, and storage locations.
```json
{
"restore": {
"database":"AdventureWorksDW2014",
"file":"c:\\awdbdwfile.abf",
"security":"...",
"allowOverwrite":"true",
"password":"..",
"locations":"d:\\SQL Server Analysis Services\\data\\",
"storageLocation":".."
}
}
```
--------------------------------
### Install TOM NuGet Package
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/tom/tom-pbi-datasets.md
Install the Microsoft.AnalysisServices.AdomdClient.NetCore.retail.amd64 NuGet package using the .NET CLI to enable TOM functionality in your .NET 5+ application.
```dotnetcli
dotnet add package Microsoft.AnalysisServices.NetCore.retail.amd64
```
--------------------------------
### Command Line Installation of Power Pivot for SharePoint
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/instances/install-windows/install-or-uninstall-the-power-pivot-for-sharepoint-add-in-sharepoint-2016.md
Use this command to install spPowerPivot16.msi from the command line with administrative privileges.
```cmd
Msiexec.exe /i spPowerPivot16.msi
```
--------------------------------
### Backup Command Example
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/tmsl/backup-command-tmsl.md
Example of a TMSL Backup command to back up a database file to the default backup folder. Requires specifying the database name, file name, and an optional password.
```json
{
"backup": {
"database":"AS_AdventureWorksDW2014",
"file":"AS_AdventureWorksDW2014.abf",
"password":"secret"
}
}
```
--------------------------------
### Command Line Installation with Specific Components
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/instances/install-windows/install-or-uninstall-the-power-pivot-for-sharepoint-add-in-sharepoint-2013.md
Install specific components of the Power Pivot for SharePoint add-in, such as data providers, excluding the configuration tool. Ensure you agree to the license terms.
```bash
Msiexec /i spPowerPivot.msi AGREETOLICENSE="yes" ADDLOCAL=" SQL_OLAPDM,SQL_ADOMD,SQL_AMO,SQLAS_SP_Common"
```
--------------------------------
### Start and Stop Trace
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/amo/programming-amo-complementary-classes-and-methods.md
Starts a configured trace to begin capturing events and stops it when monitoring is complete. The trace is then dropped to clean up resources.
```csharp
trc.Update();
trc.Start();
trc.Stop();
trc.Drop();
```
--------------------------------
### Create Session Set Example
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/multidimensional-models/mdx/mdx-named-sets-creating-session-scoped-named-sets.md
This example creates a session-scoped named set named 'SetCities_2_3' within the 'Store' cube. The set contains specific city members.
```mdx
create Session set [Store].[SetCities_2_3] as
{[Data Stores].[ByLocation].[State].&[CA].&[City 02],
[Data Stores].[ByLocation].[State].&[NH].&[City 03]}
```
--------------------------------
### Affinity Mask Examples for Processor Combinations
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/server-properties/thread-pool-properties.md
These examples illustrate different affinity mask settings based on specific processor combinations on an 8-core system. They show the bitmask and the corresponding hexadecimal value.
```text
- Affinity for processors 3-2-1-0 on an 8 core system results in this bitmask: 00001111, and a hexadecimal value: 0xF
```
```text
- Affinity for processors 7-6-5-4 on an 8 core system results in this bitmask: 11110000, and a hexadecimal value: 0xF0
```
```text
- Affinity for processors 5-4-3-2 on an 8 core system results in this bitmask: 00111100, and a hexadecimal value: 0x3C
```
```text
- Affinity for processors 7-6-1-0 on an 8 core system results in this bitmask: 11000011, and a hexadecimal value: 0xC3
```
--------------------------------
### TMDL Folder Structure Example
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/tmdl/tmdl-overview.md
This example illustrates the default folder structure for TMDL, showing how model objects are organized into sub-folders and root files for better source control management.
```md
TMDL/
├── cultures/
│ ├── en-US.tmdl
│ └── pt-PT.tmdl
├── perspectives/
│ └── perspective1.tmdl
├── roles/
│ ├── role1.tmdl
│ └── role2.tmdl
├── tables/
│ ├── About.tmdl
│ ├── Calendar.tmdl
│ ├── Customer.tmdl
│ ├── Product.tmdl
│ ├── Sales.tmdl
│ └── Store.tmdl
├── relationships.tmdl
├── functions.tmdl
├── expressions.tmdl
├── dataSources.tmdl
├── model.tmdl
└── database.tmdl
```
--------------------------------
### Create Database Example
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/xmla/xml-elements-commands/create-element-xmla.md
This example demonstrates how to use the Create element to create a new, empty database named 'Test Database' on an Analysis Services instance. The ObjectDefinition specifies the Database element with its Name and Description.
```xml
Test Database
A test database.
```
--------------------------------
### Get Cluster Accuracy Results
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/data-mining/systemgetclusteraccuracyresults-analysis-services-data-mining.md
This example returns accuracy measures for two clustering models. The code on line four indicates that the results should be based on the testing cases alone, without using any filters that might be associated with each model.
```XMLA
CALL SystemGetClusterAccuracyResults (
[vTargetMail],
[Cluster 1], [Cluster 2],
2
)
```
--------------------------------
### Get Accuracy Results for a Decision Tree Model
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/data-mining/systemgetaccuracyresults-analysis-services-data-mining.md
This example retrieves accuracy measures for a specific decision tree model using testing cases filtered by the model's own filter. It evaluates predictions for a particular target state ('Yes, will buy') and uses a state threshold of 0.5 for accuracy calculation.
```XMLA
CALL SystemGetAccuracyResults (
[vTargetMail],
[vTargetMail DT],
6,
'Bike Buyer',
1,
0.5
)
```
--------------------------------
### Create a Table with Columns and Partitions
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/tom/create-tables-partitions-and-columns-in-a-tabular-model.md
This snippet demonstrates how to create a new table with specified columns and partitions in a Tabular model. It includes adding the table to the server and requesting a full refresh.
```csharp
using System;
using Microsoft.AnalysisServices.Tabular;
namespace CreateTableSample
{
class Program
{
static void Main(string[] args)
{
// Create a new server object
// Replace with your server name
string serverName = "localhost";
Server server = new Server();
server.Connect(serverName);
// Create a new database object
Database dbWithTable = new Database("MyTabularDatabase");
dbWithTable.Model = new Model("MyModel");
// Create a new table object
Table table = new Table(dbWithTable.Model, "DimCustomer")
{
Description = "Customer dimension table"
};
// Define the query for the table
table.Query = "SELECT " +
"[FirstName], [MiddleName], [LastName], [PhoneNumber], [EmailAddress], [City] " +
"FROM [Sales].[vIndividualCustomer]";
// Define the columns for the table
table.Columns.Add(new DataColumn()
{
Name = "FirstName",
DataType = DataType.String,
SourceColumn = "FirstName"
});
table.Columns.Add(new DataColumn()
{
Name = "MiddleName",
DataType = DataType.String,
SourceColumn = "MiddleName"
});
table.Columns.Add(new DataColumn()
{
Name = "LastName",
DataType = DataType.String,
SourceColumn = "LastName"
});
table.Columns.Add(new DataColumn()
{
Name = "PhoneNumber",
DataType = DataType.String,
SourceColumn = "PhoneNumber"
});
table.Columns.Add(new DataColumn()
{
Name = "EmailAddress",
DataType = DataType.String,
SourceColumn = "EmailAddress"
});
table.Columns.Add(new DataColumn()
{
Name = "City",
DataType = DataType.String,
SourceColumn = "City"
});
// Add the table to the model
dbWithTable.Model.Tables.Add(table);
// Create a new partition for the table
Partition partition = new Partition(table)
{
Name = "DimCustomerPartition",
SourceType = PartitionSourceType.Query,
Source = "SELECT [FirstName], [MiddleName], [LastName], [PhoneNumber], [EmailAddress], [City] " +
"FROM [Sales].[vIndividualCustomer]"
};
table.Partitions.Add(partition);
// Add the new database object to the server's Databases connection and submit the changes
server.Databases.Add(dbWithTable);
dbWithTable.Model.RequestRefresh(Microsoft.AnalysisServices.Tabular.RefreshType.Full);
dbWithTable.Update(UpdateOptions.ExpandFull);
Console.Write("Database ");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write(dbWithTable.Name);
Console.ResetColor();
Console.WriteLine(" created successfully.");
Console.WriteLine("The data model includes the following table definitions:");
Console.ForegroundColor = ConsoleColor.Yellow;
foreach (Table tbl in dbWithTable.Model.Tables)
{
Console.WriteLine("\tTable name:\t\t{0}", tbl.Name);
Console.WriteLine("\ttbl description:\t{0}", tbl.Description);
}
Console.ResetColor();
Console.WriteLine();
Console.WriteLine("Press Enter to close this console window.");
Console.ReadLine();
}
}
}
```
--------------------------------
### Delete Command Examples
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/tmsl/delete-command-tmsl.md
Examples of the Delete command for various objects in TMSL.
```APIDOC
## Delete Command (TMSL)
### Description
Deletes a database or an object in the current database. It deletes the specified object and all child objects and collections. If the object does not exist, the command raises an error.
### Request Body
The object being deleted is specified by using the object path. For example, deleting a partition requires that you specify the table and database objects that precede it.
```json
{
"delete": {
"object": {
"database": "string",
"table": "string",
"partition": "string",
"dataSource": "string",
"role": "string"
}
}
}
```
### Examples
**Example 1** - Delete a database.
```json
{
"delete": {
"object": {
"database": "AdventureWorksDW2016"
}
}
}
```
**Example 2** - Delete a connection.
```json
{
"delete": {
"object": {
"database": "AdventureWorksDW2016",
"dataSource": "SqlServer localhost AdventureworksDW2016"
}
}
}
```
### Response
Returns an empty result when the command succeeds. Otherwise, an XMLA exception is returned.
```
--------------------------------
### Create and Configure Server Trace
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/amo/programming-amo-complementary-classes-and-methods.md
This snippet shows how to create, configure, and start a server trace. It includes dropping an existing trace if it exists, setting log file properties, and defining trace events with specific data columns. Trace files are saved in the Analysis Services log folder.
```csharp
static public void TestServerTraces(Server svr)
{
Trace trc;
TraceEvent te;
trc = svr.Traces.FindByName("TestServerTraces");
if (trc != null)
trc.Drop();
trc = svr.Traces.Add("TestServerTraces", "TestServerTraces");
trc.LogFileName = ("TestServerTraces_" +((Int64)(DateTime.Now.Year * 10000 + DateTime.Now.Month * 100 + DateTime.Now.Day)).ToString() + "_" +
((Int64)(DateTime.Now.Hour * 10000 + DateTime.Now.Minute * 100 + DateTime.Now.Second)).ToString() + ".trc");
trc.LogFileSize = 100;
trc.LogFileRollover = true;
trc.AutoRestart = false;
#region Define Events to trace & data columns per event
te = trc.Events.Add(TraceEventClass.ProgressReportBegin);
te.Columns.Add(TraceColumn.TextData);
te.Columns.Add(TraceColumn.StartTime);
te.Columns.Add(TraceColumn.ObjectName);
te.Columns.Add(TraceColumn.ObjectPath);
te.Columns.Add(TraceColumn.DatabaseName);
te.Columns.Add(TraceColumn.NTCanonicalUserName);
te = trc.Events.Add(TraceEventClass.ProgressReportCurrent);
te.Columns.Add(TraceColumn.TextData);
```
--------------------------------
### Filter Expression Example
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/data-mining/apply-filters-to-model-testing-data.md
An example of a filter expression to restrict testing cases by income range.
```SQL
[YearlyIncome] = '50000'
```
--------------------------------
### Create a Tabular Database with a Table and Partition
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/tom/create-tables-partitions-and-columns-in-a-tabular-model.md
This snippet demonstrates how to connect to an Analysis Services instance, create a new Tabular database, define a data source, and add a table with a partition linked to a SQL Server view. It also includes triggering a data refresh.
```C#
using System;
using Microsoft.AnalysisServices;
using Microsoft.AnalysisServices.Tabular;
namespace TOMSamples
{
class Program
{
static void Main(string[] args)
{
//
// Connect to the local default instance of Analysis Services
//
string ConnectionString = "DataSource=localhost";
//
// The using syntax ensures the correct use of the
// Microsoft.AnalysisServices.Tabular.Server object.
//
using (Server server = new Server())
{
server.Connect(ConnectionString);
//
// Generate a new database name and use GetNewName
// to ensure the database name is unique.
//
string newDatabaseName =
server.Databases.GetNewName("Database with a Table Definition");
//
// Instantiate a new
// Microsoft.AnalysisServices.Tabular.Database object.
//
var dbWithTable = new Database()
{
Name = newDatabaseName,
ID = newDatabaseName,
CompatibilityLevel = 1200,
StorageEngineUsed = StorageEngineUsed.TabularMetadata,
};
//
// Add a Microsoft.AnalysisServices.Tabular.Model object to the
// database, which acts as a root for all other Tabular metadata objects.
//
dbWithTable.Model = new Model()
{
Name = "Tabular Data Model",
Description = "A Tabular data model at the 1200 compatibility level."
};
//
// Add a Microsoft.AnalysisServices.Tabular.ProviderDataSource object
// to the data Model object created in the previous step. The connection
// string of the data source object in this example
// points to an instance of the AdventureWorks2014 SQL Server database.
//
string dataSourceName = "SQL Server Data Source Example";
dbWithTable.Model.DataSources.Add(new ProviderDataSource()
{
Name = dataSourceName,
Description = "A data source definition that uses explicit Windows credentials for authentication against SQL Server.",
ConnectionString = "Provider=SQLNCLI11;Data Source=localhost;Initial Catalog=AdventureWorks2014;Integrated Security=SSPI;Persist Security Info=false",
ImpersonationMode = Microsoft.AnalysisServices.Tabular.ImpersonationMode.ImpersonateAccount,
Account = @".\Administrator",
Password = "P@ssw0rd",
});
//
// Add a table called Individual Customers to the data model
// with a partition that points to a [Sales].[vIndividualCustomer] view
// in the underlying data source.
//
dbWithTable.Model.Tables.Add(new Table()
{
Name = dbWithTable.Model.Tables.GetNewName("Individual Customers"),
Description = "Individual customers (names and email addresses) that purchase Adventure Works Cycles products online.",
Partitions = {
//
// Create a single partition with a QueryPartitionSource for a query
// that imports all customer rows from the underlying data source.
//
new Partition() {
Name = "All Customers",
Source = new QueryPartitionSource() {
DataSource = dbWithTable.Model.DataSources[dataSourceName],
Query = @"SELECT [FirstName]
,[MiddleName]
,[LastName]
,[PhoneNumber]
,[EmailAddress]
```
--------------------------------
### Install Analysis Services in Tabular Mode via Command Line
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/instances/install-windows/install-analysis-services.md
Use this command line to install Analysis Services in Tabular mode. Replace placeholder values with your actual domain, username, and password. The INSTANCENAME must be less than 17 characters.
```PowerShell
Setup.exe /q /IAcceptSQLLicenseTerms /ACTION=install /FEATURES=AS /ASSERVERMODE=TABULAR /INSTANCENAME=ASTabular /INDICATEPROGRESS /ASSVCACCOUNT= /ASSVCPASSWORD= /ASSYSADMINACCOUNTS=
```
--------------------------------
### Analysis Services Deployment Utility Syntax
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/deployment/deploy-model-solutions-with-the-deployment-utility.md
The basic syntax for running the Microsoft.AnalysisServices.Deployment utility from the command prompt.
```console
Microsoft.AnalysisServices.Deployment [ASdatabasefile]
{[/s[:logfile]] | [/a] | [[/o[:output_script_file]] [/d]]}
```
--------------------------------
### Check ADOMD.NET Installation
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/instances/install-windows/checklist-use-powershell-to-verify-power-pivot-for-sharepoint.md
Use this script to find installed versions of Microsoft SQL Server Analysis Services ADOMD.NET.
```powershell
get-wmiobject -class win32_product | Where-Object {$_.name -like "*ado*"} | select name, version, vendor | format-table -property * -autosize | out-default
```
--------------------------------
### Quiet Command Line Installation
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/instances/install-windows/install-or-uninstall-the-power-pivot-for-sharepoint-add-in-sharepoint-2016.md
Use this command for a silent installation without user interaction. Ensure you have administrator permissions.
```powershell
Msiexec.exe /i spPowerPivot16.msi /q
```
--------------------------------
### Deploy Analysis Services Project in Silent Mode with Logging
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/deployment/deploy-model-solutions-with-the-deployment-utility.md
This example demonstrates how to run the Analysis Services Deployment Utility in silent mode to deploy a project. It specifies the deployment package location and a log file path for capturing progress and error messages.
```Command Line
Microsoft.AnalysisServices.Deployment.exe
: \My Documents\Visual Studio 2010\Projects\AdventureWorksProject\Project1\bin
/s: C:\ My Documents\Visual Studio 2010\Projects\AdventureWorksProject\Project1\bin\deployment.log
```
--------------------------------
### Create or Replace Table with Columns and Partitions
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/tmsl/createorreplace-command-tmsl.md
This snippet demonstrates how to define a table with its columns and partitions using TMSL. It includes definitions for columns with data types, source mappings, and formatting, as well as partitions with different data retrieval strategies.
```json
{
"name": "FactSalesQuota",
"columns": [
{
"name": "SalesQuotaKey",
"dataType": "int64",
"sourceColumn": "SalesQuotaKey",
"sourceProviderType": "Integer"
},
{
"name": "EmployeeKey",
"dataType": "int64",
"sourceColumn": "EmployeeKey",
"sourceProviderType": "Integer"
},
{
"name": "DateKey",
"dataType": "int64",
"sourceColumn": "DateKey",
"sourceProviderType": "Integer"
},
{
"name": "CalendarYear",
"dataType": "int64",
"sourceColumn": "CalendarYear",
"sourceProviderType": "SmallInt"
},
{
"name": "SalesAmountQuota",
"dataType": "decimal",
"sourceColumn": "SalesAmountQuota",
"formatString": "\$#,0.00;(\$#,0.00);\$#,0.00",
"sourceProviderType": "Currency",
"annotations": [
{
"name": "Format",
"value": "\"
}
]
},
{
"name": "Date",
"dataType": "dateTime",
"sourceColumn": "Date",
"formatString": "General Date",
"sourceProviderType": "DBTimeStamp"
}
],
"partitions": [
{
"name": "FactSalesQuota",
"dataView": "full",
"source": {
"query": " SELECT [dbo].[FactSalesQuota].* FROM [dbo].[FactSalesQuota] ",
"dataSource": "SqlServer localhost AdventureworksDW2016"
}
},
{
"name": "FactSalesQuota - 2011",
"mode": "import",
"dataView": "sample",
"source": {
"query": [
"SELECT [dbo].[FactSalesQuota].* FROM [dbo].[FactSalesQuota]",
"JOIN DimDate as DD",
"on DD.DateKey = FactSalesQuota.DateKey",
"WHERE DD.CalendarYear='2011'"
],
"dataSource": "SqlServer localhost AdventureworksDW2016"
},
"annotations": [
{
"name": "QueryEditorSerialization",
"value": [
"\SELECT [dbo].[FactSalesQuota].* FROM [dbo].[FactSalesQuota]",
"JOIN DimDate as DD",
"on DD.DateKey = FactSalesQuota.DateKey",
"WHERE DD.CalendarYear='2011'Text]]>"
]
}
]
}
],
"annotations": [
{
"name": "_TM_ExtProp_QueryDefinition",
"value": " SELECT [dbo].[FactSalesQuota].* FROM [dbo].[FactSalesQuota] "
},
{
"name": "_TM_ExtProp_DbTableName",
"value": "FactSalesQuota"
},
{
"name": "_TM_ExtProp_DbSchemaName",
"value": "dbo"
}
]
}
```
--------------------------------
### DRILLTHROUGH Statement Example
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/multidimensional-models/mdx/mdx-data-manipulation-retrieve-source-data-using-drillthrough.md
This example demonstrates how to use the DRILLTHROUGH statement to query specific dimensions and return particular columns from the source data.
```mdx
DRILLTHROUGH
Select {Leaves(Store), Leaves(Product), Leaves(Time),*} on 0
From Stores
RETURN [Department MeasureGroup].[Department Id], [Employee].[First Name]
```
--------------------------------
### Initialize Terraform
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/azure-analysis-services/analysis-services-create-terraform.md
This command initializes the Terraform working directory, downloading the necessary providers and modules.
```bash
terraform init
```
--------------------------------
### Example WHERE Clause Syntax for Partition Filtering
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/multidimensional-models/create-and-manage-a-local-partition-analysis-services.md
These examples demonstrate how to filter data for a specific partition using WHERE clause syntax in SQL. Ensure filters are mutually exclusive across partitions to prevent data duplication.
```sql
WHERE OrderDateKey >= '20060101'
```
```sql
WHERE OrderDateKey BETWEEN '20051001' AND '20051201'
```
--------------------------------
### Get Characteristics for All Clusters
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/data-mining/sequence-clustering-model-query-examples.md
Retrieves characteristics for all clusters when the cluster ID is left empty. Use this to get a broad overview of all clusters in the model.
```DMX
CALL System.Microsoft.AnalysisServices.System.DataMining.Clustering.GetClusterCharacteristics('Sequence Clustering','',0.0005)
```
--------------------------------
### Calculation Group Precedence Example 2
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/tabular-models/calculation-groups.md
Shows the same calculation as the previous example, but with the base measure's value substituted, illustrating the intermediate step in the evaluation.
```DAX
( ( 10 ) + 2 ) * 2
```
--------------------------------
### Example Row Filter for a Specific Country
Source: https://github.com/microsoftdocs/bi-shared-docs/blob/main/docs/analysis-services/tabular-models/roles-ssas-tabular.md
This DAX expression filters rows in the Customers table to show only those where the Country is 'USA'. This is a basic example of row-level security.
```DAX
Customers[Country] = "USA"
```