0
我有下面的查詢是動態生成的,但它需要10秒是否有更好的方法來做到這一點?可以有1到N個農場ID。我真的很想在結果集中返回ID。但是,如果我有一個where子句做與出得到的錯誤MDX過濾器性能
成員,元組或多組必須在函數中使用相同的層次結構
SELECT NON EMPTY { [Measures].[Deliveries], [Measures].[Cows per Delivery] } ON COLUMNS, NON EMPTY { ([Farm].[Farm Number].[Farm Number].ALLMEMBERS * [Farm].[Farm Name].[Farm Name].ALLMEMBERS, FILTER( [Farm].[Farm ID].Members, ([Farm].[Farm ID].Member_value = 21393) or ([Farm].[Farm ID].Member_value = 21395) or ([Farm].[Farm ID].Member_value = 21396) or ([Farm].[Farm ID].Member_value = 21399) or ([Farm].[Farm ID].Member_value = 21400) or ([Farm].[Farm ID].Member_value = 21401) or ([Farm].[Farm ID].Member_value = 21402) or ([Farm].[Farm ID].Member_value = 21403) or ([Farm].[Farm ID].Member_value = 21404) or ([Farm].[Farm ID].Member_value = 21405) or ([Farm].[Farm ID].Member_value = 21406) or ([Farm].[Farm ID].Member_value = 21407) or ([Farm].[Farm ID].Member_value = 21408) or ([Farm].[Farm ID].Member_value = 21410) or ([Farm].[Farm ID].Member_value = 21411) or ([Farm].[Farm ID].Member_value = 21585) or ([Farm].[Farm ID].Member_value = 21590) or ([Farm].[Farm ID].Member_value = 21591) or ([Farm].[Farm ID].Member_value = 21592) or ([Farm].[Farm ID].Member_value = 21593) or ([Farm].[Farm ID].Member_value = 21594) or ([Farm].[Farm ID].Member_value = 21595) or ([Farm].[Farm ID].Member_value = 21596) or ([Farm].[Farm ID].Member_value = 21597) or ([Farm].[Farm ID].Member_value = 21598) or ([Farm].[Farm ID].Member_value = 21599) or ([Farm].[Farm ID].Member_value = 21600) or ([Farm].[Farm ID].Member_value = 21601) or ([Farm].[Farm ID].Member_value = 21602) or ([Farm].[Farm ID].Member_value = 21603) or ([Farm].[Farm ID].Member_value = 21604) or ([Farm].[Farm ID].Member_value = 21605) or ([Farm].[Farm ID].Member_value = 21606) or ([Farm].[Farm ID].Member_value = 21607) or ([Farm].[Farm ID].Member_value = 21608) or ([Farm].[Farm ID].Member_value = 21609) or ([Farm].[Farm ID].Member_value = 21610) or ([Farm].[Farm ID].Member_value = 21611) or ([Farm].[Farm ID].Member_value = 21612) or ([Farm].[Farm ID].Member_value = 21613) or ([Farm].[Farm ID].Member_value = 21614) or ([Farm].[Farm ID].Member_value = 21615) or ([Farm].[Farm ID].Member_value = 21616) or ([Farm].[Farm ID].Member_value = 21617) or ([Farm].[Farm ID].Member_value = 21618) or ([Farm].[Farm ID].Member_value = 21619) or ([Farm].[Farm ID].Member_value = 21620) or ([Farm].[Farm ID].Member_value = 21621) or ([Farm].[Farm ID].Member_value = 21674) or ([Farm].[Farm ID].Member_value = 21676) or ([Farm].[Farm ID].Member_value = 21677) or ([Farm].[Farm ID].Member_value = 21678) or ([Farm].[Farm ID].Member_value = 21679) or ([Farm].[Farm ID].Member_value = 21680) or ([Farm].[Farm ID].Member_value = 21681) or ([Farm].[Farm ID].Member_value = 21682) or ([Farm].[Farm ID].Member_value = 21683) or ([Farm].[Farm ID].Member_value = 21684) or ([Farm].[Farm ID].Member_value = 21686) or ([Farm].[Farm ID].Member_value = 21687) or ([Farm].[Farm ID].Member_value = 21688) or ([Farm].[Farm ID].Member_value = 21689) or ([Farm].[Farm ID].Member_value = 21690) or ([Farm].[Farm ID].Member_value = 21691) or ([Farm].[Farm ID].Member_value = 21692) or ([Farm].[Farm ID].Member_value = 21693) or ([Farm].[Farm ID].Member_value = 21694) or ([Farm].[Farm ID].Member_value = 21974) or ([Farm].[Farm ID].Member_value = 21975) or ([Farm].[Farm ID].Member_value = 21976) or ([Farm].[Farm ID].Member_value = 21977) or ([Farm].[Farm ID].Member_value = 21978) or ([Farm].[Farm ID].Member_value = 20872) or ([Farm].[Farm ID].Member_value = 20873) or ([Farm].[Farm ID].Member_value = 20874) or ([Farm].[Farm ID].Member_value = 20875) or ([Farm].[Farm ID].Member_value = 20876) or ([Farm].[Farm ID].Member_value = 20877) or ([Farm].[Farm ID].Member_value = 20878) or ([Farm].[Farm ID].Member_value = 20879) or ([Farm].[Farm ID].Member_value = 20880) or ([Farm].[Farm ID].Member_value = 20881) or ([Farm].[Farm ID].Member_value = 20882) or ([Farm].[Farm ID].Member_value = 20883) or ([Farm].[Farm ID].Member_value = 20884) or ([Farm].[Farm ID].Member_value = 20885) or ([Farm].[Farm ID].Member_value = 20886) or ([Farm].[Farm ID].Member_value = 20887) or ([Farm].[Farm ID].Member_value = 20888) or ([Farm].[Farm ID].Member_value = 20889) or ([Farm].[Farm ID].Member_value = 20890) or ([Farm].[Farm ID].Member_value = 20891) or ([Farm].[Farm ID].Member_value = 20892) or ([Farm].[Farm ID].Member_value = 20893) or ([Farm].[Farm ID].Member_value = 20894) or ([Farm].[Farm ID].Member_value = 20895) or ([Farm].[Farm ID].Member_value = 20896) or ([Farm].[Farm ID].Member_value = 20897) or ([Farm].[Farm ID].Member_value = 20899) or ([Farm].[Farm ID].Member_value = 20900) or ([Farm].[Farm ID].Member_value = 20901) or ([Farm].[Farm ID].Member_value = 20902) or ([Farm].[Farm ID].Member_value = 20903) or ([Farm].[Farm ID].Member_value = 20904) or ([Farm].[Farm ID].Member_value = 20927) or ([Farm].[Farm ID].Member_value = 20928) or ([Farm].[Farm ID].Member_value = 20929) or ([Farm].[Farm ID].Member_value = 21203) or ([Farm].[Farm ID].Member_value = 21757) or ([Farm].[Farm ID].Member_value = 21493) or ([Farm].[Farm ID].Member_value = 21494) or ([Farm].[Farm ID].Member_value = 21496) or ([Farm].[Farm ID].Member_value = 21497) or ([Farm].[Farm ID].Member_value = 21498) or ([Farm].[Farm ID].Member_value = 21499) or ([Farm].[Farm ID].Member_value = 21500) or ([Farm].[Farm ID].Member_value = 21501) or ([Farm].[Farm ID].Member_value = 21502) or ([Farm].[Farm ID].Member_value = 21503) or ([Farm].[Farm ID].Member_value = 21504) or ([Farm].[Farm ID].Member_value = 21505) or ([Farm].[Farm ID].Member_value = 21506) or ([Farm].[Farm ID].Member_value = 21507) or ([Farm].[Farm ID].Member_value = 21508) or ([Farm].[Farm ID].Member_value = 21509) or ([Farm].[Farm ID].Member_value = 21510) or ([Farm].[Farm ID].Member_value = 21511) or ([Farm].[Farm ID].Member_value = 21512) or ([Farm].[Farm ID].Member_value = 21571) or ([Farm].[Farm ID].Member_value = 21587) or ([Farm].[Farm ID].Member_value = 21588) or ([Farm].[Farm ID].Member_value = 21589) or ([Farm].[Farm ID].Member_value = 22045) or ([Farm].[Farm ID].Member_value = 22046) or ([Farm].[Farm ID].Member_value = 22047) or ([Farm].[Farm ID].Member_value = 22048) )) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM( SELECT ({ [Barn].[Barn ID].&[8141] }) ON COLUMNS FROM
(SELECT ({ [Time].[Date].&[2017-02-01T00:00:00]:[Time].[Date].&[2017-02-28T00:00:00] }) ON COLUMNS FROM
[Farms])
)
WHERE ([Time].[Date].&[2017-02-01T00:00:00]:[Time].[Date].&[2017-02-28T00:00:00] ,
[Barn].[Barn ID].&[8141]
) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
有沒有一種方法可以讓結果在結果中包含農場的ID?沒有得到像成員一樣的錯誤,元組或集合必須在函數 –
中使用相同的層次結構我已更新答案。裁剪版本適合你嗎? –
是的,我今天會嘗試...但是,裁剪版本會很好,謝謝你的幫助! –