Scope vs value assignment
-
03 Mei 2012 2:05
Can someone explain to me the difference (if any) between these two mdx statements? I'm trying to determine if one is better than the one in terms of performance.
This:
Scope([Measures].[Sales Amount]);
FORMAT_STRING(this) = "#,##0.00";
End Scope;Or this:
FORMAT_STRING([Measures].[Sales Amount]) = "#,##0.00";
Is there any difference between these two statements?
Semua Balasan
-
03 Mei 2012 4:28
Hi David,
One noticeable difference can be
what if you have an account dimension and Member in that dimension called "Expenses". Now you want to apply this format only to Expenses member and no other dimension or members.So using scope you can achieve something like this...
Scope([Measures].[Sales Amount], {[Account].[Account].&[Expenses]});
FORMAT_STRING(this) = "#,##0.00";
End Scope;So the above would be scoping around [Sales Amount] and Expenses member.
But you cannot use it for
FORMAT_STRING([Measures].[Sales Amount],{[Account].[Account].&[Expenses]}) = "#,##0.00";
I don't think the above is possible.
Regards
Gokul
- Disarankan sebagai Jawaban oleh Rakesh M JMicrosoft Employee 03 Mei 2012 15:14
-
03 Mei 2012 21:08
Actually I was only wondering about that specific case where you scope only on a measure and assign it a value (or in my case a dynamic format_string).
All examples I see on the web use a scope statement but it seems to me that a direct assignment (as in my second example) does exactly the same thing. Now since I only saw examples using a scope statement, I was wondering if there is not something I was missing. Performance or behavior wise.
-
05 Mei 2012 3:00Moderator
Hi David,
In your case, the 2 approaches doesn't have difference in performance because they don't have different calculation space. Please refer to this white paper http://www.microsoft.com/en-us/download/details.aspx?id=17303 to learn more relevant information.
Regards,
Jerry- Ditandai sebagai Jawaban oleh David Laplante 05 Mei 2012 3:19