

"TOTALQTD(" + m.DaxObjectName + ", " + dateColumn + ")", // DAX expression ).FormatString = "0.0 %" // Set format string as percentage M.DaxObjectName + " - ", // DAX expression "CALCULATE(" + m.DaxObjectName + ", SAMEPERIODLASTYEAR(" + dateColumn + "))", // DAX expression "TOTALYTD(" + m.DaxObjectName + ", " + dateColumn + ")", // DAX expression Creates time intelligence measures for every selected measure: Of course, you may also put all your time intelligence calculations into a single script such as the following: var dateColumn = "'Date'" Save this as a new Custom Action "Time Intelligence\All of the above", and you will have an easy way to generate all your Time Intelligence measures with a single click: This illustrates how you can execute one (or more) Custom Actions from within another action (beware of circular references - that will cause Tabular Editor to crash). Then, create the following as a new action: // Invoke all Time Intelligence Custom Intelligence\Create YTD Intelligence\Create MTD Intelligence\Create LY measure") Create similar actions for MTD, LY, and whatever else you need. Save this as a Custom Action called "Time Intelligence\Create YTD measure" that applies to measures. Here, we use the DaxObjectName property, to generate an unqualified reference for use in the DAX expression, as this is a measure. "TOTALYTD(" + m.DaxObjectName + ", 'Date')", // DAX expression For example: // Creates a TOTALYTD measure for every selected measure.

We use the DaxObjectFullName property to get the fully qualified name of the column for use in the DAX expression: 'TableName'.įirst, create custom actions for individual Time Intelligence aggregations. AddMeasure(,, ) function to create a new measure on the table. NewMeasure.Description = "This measure is the sum of column " + c.DaxObjectFullName Set the format string on the new measure: "SUM(" + c.DaxObjectFullName + ")", // DAX expression Many of these scripts are useful to save as Custom Actions, so that you can easily reuse them from the context menu.'Īlso, make sure to check out our script library C# Script Library, for some more real-life examples of what you can do with the scripting capabilities of Tabular Editor.Ĭreate measures from columns // Creates a SUM measure for every currently selected column and hide the column. RDBMSs represent data in a tabular format whereas object-oriented languages, such as Java or C# represent it as an interconnected graph of objects.Here's a collection of small script snippets to get you started using the Advanced Scripting functionality of Tabular Editor. When we work with an object-oriented system, there is a mismatch between the object model and the relational database. JDBC provides a flexible architecture to write a database independent application that can run on different platforms and interact with different DBMS without any modification. These Java APIs enables Java programs to execute SQL statements and interact with any SQL compliant database. It provides a set of Java API for accessing the relational databases from Java program. JDBC stands for Java Database Connectivity.
