Distinct (MDX)
Evaluates a specified set, removes duplicate tuples from the set, and returns the resulting set.
Syntax
Distinct(Set_Expression)
Arguments
Set_Expression
A valid Multidimensional Expressions (MDX) expression that returns a set.
Remarks
If the Distinct function finds duplicate tuples in the specified set, the function keeps only the first instance of the duplicate tuple while leaving the order of the set intact.
Examples
The following example query shows how to use the Distinct function with a named set, as well as how to use it with the Count function to find the number of distinct tuples in a set:
WITH SET MySet AS
{[Customer].[Customer Geography].[Country].&[Australia],[Customer].[Customer Geography].[Country].&[Australia],
[Customer].[Customer Geography].[Country].&[Canada],[Customer].[Customer Geography].[Country].&[France],
[Customer].[Customer Geography].[Country].&[United Kingdom],[Customer].[Customer Geography].[Country].&[United Kingdom]}
MEMBER MEASURES.SETCOUNT AS
COUNT(MySet)
MEMBER MEASURES.SETDISTINCTCOUNT AS
COUNT(DISTINCT(MySet))
SELECT {MEASURES.SETCOUNT, MEASURES.SETDISTINCTCOUNT} ON 0,
DISTINCT(MySet) ON 1
FROM [Adventure Works]
See Also
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho