Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MDX currentMember get me error

Tags:

ssas

mdx

This MDX function raise error :

with member measures.x as 
(
     [Date].[Date].[Date].&[20160101] : [Date].[Date].[Date].currentmember.value
    ,
    [Measures].[current balance]
)

select  measures.x  on columns,
[Branch].[HeadOffice Branch].[Head Office Code] on rows
from MyCube

Error is : The CURRENTMEMBER function expects a hierarchy expression for the 1 argument. A member expression was used.

But when I use [Date].[Date].[Date].&[20160101] : [Date].[Date].[Date].&[20160131] It works good

why?

like image 337
Mahdi Moghimi Avatar asked Oct 27 '25 14:10

Mahdi Moghimi


2 Answers

This is valid mdx:

[Date].[Date].[Date].&[20160101] : [Date].[Date].currentmember

Although this is not:

WITH member measures.x AS
  (
     [Date].[Date].[Date].&[20160101] : [Date].[Date].currentmember
    ,
    [Measures].[current balance]
  )

It is not valid because round braces (...) signify a tuple but a tuple requires exact co-ordinates so the first argument cannot be a set.

You could add an aggregation such as SUM:

WITH member measures.x AS
  SUM 
   (
     [Date].[Date].[Date].&[20160101] : [Date].[Date].currentmember
    ,
    [Measures].[current balance]
   )

This is valid mdx but if you do not have [Date].[Date] in context i.e. in the WHERE or SELECT clause then all it is returning is the All member.

Why are you using [Date].[Date].currentmember ?

like image 143
whytheq Avatar answered Oct 29 '25 17:10

whytheq


CURRENTMEMBER works on an attribute hierarchy (in your case [Date].[Date]). So [Date].[Date].CURRENTMEMBER will work.

Also you will need to take out the value selector, as your expression returns a set of dates (member : member returns a set of all the members between those two members).

like image 28
The Dumb Radish Avatar answered Oct 29 '25 18:10

The Dumb Radish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!