SSAS Tabular - How to create Daily Partition on Fact and execute from Stored Procedure

PANDEY Prashant 145 Reputation points
2025-01-15T06:18:26.0133333+00:00

Hello Experts,

We have DWH & Tabular database having numbers of Dim and 2 Fact tables. One of the fact table session_member expect 1 millions of data processing per day.

Earlier we had no Partitions on Fact tables of Datawarehouse and monthly partitions on tabular fact tables. Now have introduced daily partitions on Fact data warehouse table and accordingly would like to create/amend the existing monthly partitions.

The monthly Partitions on tabular table was being created for next 12 monthly manually in advance, since we have to processes daily partitions can anyone please suggest way to do so?

Below is the code of SP being used to process monthly partitions , where the partitions were already created in advance manually.

CREATE PROCEDURE ProcessMonthlyPartition

AS

BEGIN

    DECLARE @CurrentMonth NVARCHAR(20)

    DECLARE @PartitionName NVARCHAR(100)

    DECLARE @JsonCommand NVARCHAR(MAX)

    DECLARE @CurrentYear NVARCHAR(4)

    DECLARE @DataBaseName NVARCHAR(100) = 'dev-ssas'

   DECLARE @TableName NVARCHAR(100) = 'fact_viewing_session_member'

    SET @CurrentMonth = DATENAME(MONTH, GETDATE())

    SET @CurrentYear = DATEPART(YEAR, GETDATE())

    SET @PartitionName = 'Partition_' + @CurrentMonth + '_' + @CurrentYear

       SET @JsonCommand = '{

        "refresh": {

            "type": "automatic",

            "objects": [

                {

                    "database": "' + @DataBaseName + '",

                    "table": "' + @TableName + '",

                    "partition": "' + @PartitionName + '"

                }

            ]

        }

    }'

    EXEC (@JsonCommand) AT SSASTABULAR; -- linked server name

END

SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,307 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.