Force mdx query to return column names

前端 未结 2 1916
迷失自我
迷失自我 2021-01-22 19:07

When connecting from powerpivot to SSAS, I got the following problem - if for some reason no rows are returned by mdx query, no column names are returned either and powerpivot g

2条回答
  •  走了就别回头了
    2021-01-22 19:35

    re SSIS error: [MEMBER_CAPTION] cannot be found at the datasource.

    Thanks your solution helped me. I had the same issue using SSIS, SSAS to output a flat file report

    i'll post an extended example to help others define the dummy set. Please note that the date is inserted into MDX script dynamically.

    SSIS throws an exception when no data exists for the date, and therefore no results are returned. This messes up the column order

    --create a blank set so that data is still returned when there are no results for that date
    set [BlankRowSet] as 
    ([Activity Period].[Days].[Day].&[2014-02-02T00:00:00], [Well].[Location].[Location].&[])
    
    --create the active set as the crossjoin between Days, Wells
    set [ActiveSet] as 
    nonempty([Activity Period].[Days].[Day].members * [Well].[Location].[Location].members )
    
    SET [RealSet] as IIF(COUNT([ActiveSet]) > 0, [ActiveSet], {[BlankRowSet]}) 
    
    
    select {[Measures].[Total boe]} ON COLUMNS 
    ,[RealSet] ON ROWS 
    FROM 
    (select {[Activity Period].[Days].[Day].&[2014-02-02T00:00:00]:[Activity Period].[Days].[Day].&    [2014-02-02T00:00:00]} on 0 from [Volumes] )
    
    where 
    [Scenario].[All Scenarios].[Category].&[PVR Sales Estimates] 
    

提交回复
热议问题