Exemple #1
0
        /// <summary>
        /// Builds DAX query based on location on pivot table (specified in parameters). This returns all columns in the table.
        /// </summary>
        /// <param name="tabular">Tabular connection helper</param>
        /// <param name="pivotCellDic">Dictionary representing Pivot Table context filters</param>
        /// <param name="measureName">Name of DAX measure to be used in drillthrough</param>
        /// <param name="maxRecords">Maximum records to be retrieved</param>
        /// <param name="detailColumns">List of columns to be included in drill-through</param>
        /// <returns></returns>
        public static string BuildQueryText(DaxDrill.Tabular.TabularHelper tabular, PivotCellDictionary pivotCellDic, string measureName,
                                            int maxRecords, IEnumerable <DetailColumn> detailColumns,
                                            IEnumerable <string> pivotFieldNames)
        {
            var    measure     = tabular.GetMeasure(measureName);
            string commandText = BuildCustomQueryText(tabular, pivotCellDic, measure.TableName, maxRecords, detailColumns, pivotFieldNames);

            return(commandText);
        }
Exemple #2
0
        private TabularItems.Measure GetMeasure(Excel.Range rngCell)
        {
            var cnnBuilder = new TabularConnectionStringBuilder(this.connectionString);

            string measureName = GetMeasureName(rngCell);

            TabularItems.Measure measure = null;
            using (var tabular = new DaxDrill.Tabular.TabularHelper(cnnBuilder.DataSource, cnnBuilder.InitialCatalog))
            {
                tabular.Connect();
                measure = tabular.GetMeasure(measureName);
                tabular.Disconnect();
            }
            return(measure);
        }