question

claudiochignoli-3217 avatar image
0 Votes"
claudiochignoli-3217 asked HimanshuSinha-MSFT commented

Analysis Services as Power Query source - convert YYYYMM string to date in MDX

I need to covert YYYYMM string ( [DimDate].[Calculation Period].[Calculation Period]) to date in MDX when importing data from Analysis Service OLAP database to Power Query (to keep the Native Query active and apply incremental refresh)
Here the native query

 SELECT
     {
         [Measures].[Quantity],
         [Measures].[Sales YTD],
         [Measures].[Sales]
     }ON 0,
     ORDER(
         NONEMPTY(
             CROSSJOIN(
                 CROSSJOIN(
                     CROSSJOIN(
                         CROSSJOIN(
                             CROSSJOIN(
                                 CROSSJOIN(
                                     CROSSJOIN(
                                         CROSSJOIN(
                                             CROSSJOIN(
                                                 CROSSJOIN(
                                                     CROSSJOIN(
                                                         CROSSJOIN(
                                                             [DimDate].[Calculation Period].[Calculation Period].ALLMEMBERS,
                                                             ADDCALCULATEDMEMBERS(
                                                                 DESCENDANTS(
                                                                     [DimDate].[Date Hierarchy].[Year].ALLMEMBERS,
                                                                     [DimDate].[Date Hierarchy].[Month Desc],
                                                                     LEAVES
                                                                 )
                                                             )
                                                         ),
                                                         [DimDate].[Month].[Month].ALLMEMBERS
                                                     ),
                                                     [DimDate].[Year].[Year].ALLMEMBERS
                                                 ),
                                                 [DimDistributionChannel].[Channel].[Channel].ALLMEMBERS
                                             ),
                                             [DimMarketOrganization].[Factory].[Factory].ALLMEMBERS
                                         ),
                                         [DimProductLine].[Code].[Code].ALLMEMBERS
                                     ),
                                     [DimProductLine].[PRODUCT1].[PRODUCT1].ALLMEMBERS
                                 ),
                                 [DimProductLine].[PRODUCT2].[PRODUCT2].ALLMEMBERS
                             ),
                             [DimProductLine].[PRODUCT3].[PRODUCT3].ALLMEMBERS
                         ),
                         [DimProductLine].[PRODUCT].[PRODUCT].ALLMEMBERS
                     ),
                     [DimProductLine].[Product Line Hierarchy].[PL Division].ALLMEMBERS
                 ),
                 [DimProductOrganization].[Organization].[Organization].ALLMEMBERS
             ),
             {
                 [Measures].[Quantity],
                 [Measures].[Sales YTD],
                 [Measures].[Sales]
             }
         ),
         ANCESTOR(
             [DimDate].[Date Hierarchy].CURRENTMEMBER,
             [DimDate].[Date Hierarchy].[Year]
         ).MEMBER_CAPTION,
         BDESC
     )
     PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON 1
 FROM [xxxxx] CELL PROPERTIES VALUE

Could you please help me with how to convert [DimDate].[Calculation Period].[Calculation Period] to date format (like YYYY+MM+01)

Thanks a lot

power-query-not-supportedazure-analysis-services
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @claudiochignoli-3217,
Thanks for the question and using MS Q&A platform.
As we understand the ask here is to convert YYYYMM string to date , please do let us know if its not accurate.
The YYYYMM is not even a valid date , you will have to use something like YYYYMMMDD .
Additionally can you please elaborate more on

to Power Query (to keep the Native Query active and apply incremental refresh)


Please do let me if you have any queries.
Thanks
Himanshu

0 Votes 0 ·

Hello @claudiochignoli-3217,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet .In case if you have any resolution please do share that same with the community as it can be helpful to others . Otherwise, will respond back with the more details and we will try to help .
Thanks
Himanshu

0 Votes 0 ·

0 Answers