변수 및 매개 변수 사용(MDX)
적용 대상: SQL Server Analysis Services Azure Analysis Services 패브릭/Power BI Premium
Microsoft SQL Server SQL Server Analysis Services MDX(다차원 식) 문을 매개 변수화할 수 있습니다. 매개 변수가 있는 문을 사용하면 런타임에 사용자 정의가 가능한 범용 문을 만들 수 있습니다.
매개 변수가 있는 문을 만들 때 매개 변수 이름은 이름 앞에 @ 부호를 붙여 식별합니다. 예를 들어 는 @Year 유효한 매개 변수 이름이 됩니다.
MDX는 리터럴 또는 스칼라 값을 위한 매개 변수만 지원합니다. 멤버, 집합 또는 튜플을 참조하는 매개 변수를 만들려면 StrToMember 또는 StrToSet와 같은 함수를 사용해야 합니다.
다음 XMLA(XML for Analysis) 예제 @CountryName 에서 매개 변수에는 고객 데이터가 검색되는 국가/지역이 포함됩니다.
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<Execute xmlns="urn:schemas-microsoft-com:xml-analysis">
<Command>
<Statement>
select [Measures].members on 0,
Filter(Customer.[Customer Geography].Country.members,
Customer.[Customer Geography].CurrentMember.Name =
@CountryName) on 1
from [Adventure Works]
</Statement>
</Command>
<Properties />
<Parameters>
<Parameter>
<Name>CountryName</Name>
<Value>'United Kingdom'</Value>
</Parameter>
</Parameters>
</Execute>
</Body>
</Envelope>
OLE DB와 함께 이 기능을 사용하려면 ICommandWithParameters 인터페이스를 사용하십시오. ADOMD.Net과 함께 이 기능을 사용하려면 AdomdCommand.Parameters 컬렉션을 사용하십시오.
참고 항목
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기