2016-03-05 65 views
-1

我希望一次我需要一個快速的幫助下面的MDX查詢

case 
when [measure].[frequency] >3 and [poa].[segment].&A then 'red' 
when [measure].[frequency] <3 and [poa].[segment].&A then 'yellow' 
when [measure].[frequency] =3 and [poa].[segment].&A then 'Green' 
else 'NA' end 

這些我已經寫在計算成員腳本..篩選的指標和維度的資料,但並不成功運行。親愛的幫助我們

+0

請儘快幫助我 – Adi

+0

爲什麼它不起作用?你得到一個錯誤或不正確的結果?提供錯誤結果和期望結果的截圖。 – GregGalloway

+0

它顯示像#valueerr – Adi

回答

0

您是否需要在案例中添加currentMember比較?

我想這會工作好嗎?

case 
when [measure].[frequency] >3 then 'red' 
when [measure].[frequency] <3 then 'yellow' 
when [measure].[frequency] =3 then 'Green' 
else 'NA' 
end 

雖然您是否必須使用'NA'?在這種情況下你不能使用null嗎?

case 
when [measure].[frequency] >3 then 'red' 
when [measure].[frequency] <3 then 'yellow' 
when [measure].[frequency] =3 then 'Green' 
else NULL 
end 

你計算的其他部分看起來像它需要使用IS運營商這樣的比較[poa].[segment].&A反對的東西:

([poa].CURRENTMEMBER IS [poa].[segment].&A) 

所以加入這個到case聲明:

CASE 
WHEN [measure].[frequency] >3 
     AND ([poa].CURRENTMEMBER IS [poa].[segment].&A) THEN 'red' 
WHEN [measure].[frequency] <3 
     AND ([poa].CURRENTMEMBER IS [poa].[segment].&A) THEN 'yellow' 
WHEN [measure].[frequency] =3 
     AND ([poa].CURRENTMEMBER IS [poa].[segment].&A) THEN 'Green' 
ELSE NULL 
END