ssas - Checking Multiple condition in case statement using MDX query -


how write below case statement in mdx.i moved below mentioned columns in fact table.

   sum(case when issummary = 1 , isaudited  = 1 , finalauditflag = 1 1  else 0 end) auditscompleted,--count - completed audits 

i tried below mdx query.

with       member [measures].[count]         (      case  ([measures].currentmember )             when 0 ([measures].[is summary] )                     else 1              end          )     select              {[measures].[count]}    on 0,             [dim_table1].[tableid].members  on 1        [dsv]    

what have done correct. change .currentmember actual measure in cube. when have following referring i.e. currentmember black arrow referring measure count black arrow...

enter image description here

this in advwrks:

select    {[measures].[internet sales amount]} on 0  ,{[product].[product categories].[category]} on 1 [adventure works]; 

it returns this:

enter image description here

if want replace empty cell components can use case:

with    member [measures].[count]        case  [measures].[internet sales amount]         when 0 "xxx"                        else [measures].[internet sales amount]        end  ,format_string = "#,###,##0" select    {    [measures].[count]   } on 0  ,{[product].[product categories].[category]} on 1 [adventure works]; 

this returns this:

enter image description here

iif used lot more in mdx case - iif faster. above equivalent using iif following:

with    member [measures].[count]      iif     (       [measures].[internet sales amount] = 0      ,"xxx"      ,[measures].[internet sales amount]     )     ,format_string = "#,###,##0"  select    {[measures].[count]} on 0  ,{[product].[product categories].[category]} on 1 [adventure works]; 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -