Showing posts with label parents. Show all posts
Showing posts with label parents. Show all posts

Wednesday, March 28, 2012

Parents of a SET of members

Hello,

I have a set of members, generated with a SET clause at the top of my MDX query.
Once I have this set, what function can I use on an axis to determine the parents (i.e the level above) of these members? Those parents will be a set too as the original set will have many different parents.

Or am I going about this the wrong way?

Thanks in advance
Mgale1

Try something like:

SELECT Generate({...} as Set1, ANCESTORS(Set1.CurrentMember, 1)) FROM MyCube

|||

Matt,

Thanks for the reply - unfortunately it gives me an error of "The CURRENT function cannot be invoked in this context because the 'MissedJobs' set is not in the scope."

My full query is :

WITH
MEMBER [Measures].[Incidence TY] AS SUM({[Media].[Media].CURRENTMEMBER},([Timeslice].[Timeslice].&[1], [Measures].[Incidence])),FORMAT_STRING = "#,##0.00",NON_EMPTY_BEHAVIOR=[Measures].[Incidence]
MEMBER [Measures].[MyPublicationValue] AS SUM({[Media].[Media].&[7004]},[Measures].[Incidence TY]) ,NON_EMPTY_BEHAVIOR=[Measures].[Incidence]
SET [MissedJobs] AS Filter(Existing([Job].[Job].CHILDREN),NOT [Measures].[MyPublicationValue])

--Produce Report
SELECT CROSSJOIN
(VISUALTOTALS({[Media].[Media].[All], [Media].[Media].&[7002],[Media].[Media].&[7004]})
,{[Measures].[Incidence TY]
}) ON COLUMNS,
NON EMPTY ANCESTORS([MissedJobs].CurrentMember,1) ON ROWS
FROM jdx_cube
WHERE [Date].[Full Date].&[2007-07-01T00:00:00]:[Date].[Full Date].&[2007-07-30T00:00:00]

The critical dimension here is the Job dimension. It has 2 attributes where the "Advertiser" atrib is the parent of the "Job" atrb. In my Set statement in the WITH section I work out which Jobs I dont have and then I want the query to return the Advertisers that 'parent' the jobs I dont have.

Can you offer anymore help please?

Thanks

Mgale1

|||

Try:

...

NON EMPTY GENERATE([MissedJobs], ANCESTORS([MissedJobs].CurrentMember, 1)) ON ROWS

...

|||

Hello Matt,

Thanks for the reply and I am sorry for not getting back to this thread earlier (been ill).

Unfortunately this is not quite what I want and I should have been clearer in my initial question.
I want to work out the missed jobs set but then display on the axis the name of the 'parent' advertiser but the value in the cellset should be the value of the missed jobs and NOT the value for the parent (which is what this GENERATE solution gives me).

What I mean is, if Advertiser1 has two jobs (Job11 and Job12) with values of 11 and 12 respectively and my Missed Jobs set calculates that only Job 11 applies, then I want to see "Advertiser1, 11 "on the axis.
The GENERATE approach displays "Advertiser1, 23" which is not what I am after.

Do you have any other ideas please?

With continuing thanks
Mgale1

Parents of a SET of members

Hello,

I have a set of members, generated with a SET clause at the top of my MDX query.
Once I have this set, what function can I use on an axis to determine the parents (i.e the level above) of these members? Those parents will be a set too as the original set will have many different parents.

Or am I going about this the wrong way?

Thanks in advance
Mgale1

Try something like:

SELECT Generate({...} as Set1, ANCESTORS(Set1.CurrentMember, 1)) FROM MyCube

|||

Matt,

Thanks for the reply - unfortunately it gives me an error of "The CURRENT function cannot be invoked in this context because the 'MissedJobs' set is not in the scope."

My full query is :

WITH
MEMBER [Measures].[Incidence TY] AS SUM({[Media].[Media].CURRENTMEMBER},([Timeslice].[Timeslice].&[1], [Measures].[Incidence])),FORMAT_STRING = "#,##0.00",NON_EMPTY_BEHAVIOR=[Measures].[Incidence]
MEMBER [Measures].[MyPublicationValue] AS SUM({[Media].[Media].&[7004]},[Measures].[Incidence TY]) ,NON_EMPTY_BEHAVIOR=[Measures].[Incidence]
SET [MissedJobs] AS Filter(Existing([Job].[Job].CHILDREN),NOT [Measures].[MyPublicationValue])

--Produce Report
SELECT CROSSJOIN
(VISUALTOTALS({[Media].[Media].[All], [Media].[Media].&[7002],[Media].[Media].&[7004]})
,{[Measures].[Incidence TY]
}) ON COLUMNS,
NON EMPTY ANCESTORS([MissedJobs].CurrentMember,1) ON ROWS
FROM jdx_cube
WHERE [Date].[Full Date].&[2007-07-01T00:00:00]:[Date].[Full Date].&[2007-07-30T00:00:00]

The critical dimension here is the Job dimension. It has 2 attributes where the "Advertiser" atrib is the parent of the "Job" atrb. In my Set statement in the WITH section I work out which Jobs I dont have and then I want the query to return the Advertisers that 'parent' the jobs I dont have.

Can you offer anymore help please?

Thanks

Mgale1

|||

Try:

...

NON EMPTY GENERATE([MissedJobs], ANCESTORS([MissedJobs].CurrentMember, 1)) ON ROWS

...

|||

Hello Matt,

Thanks for the reply and I am sorry for not getting back to this thread earlier (been ill).

Unfortunately this is not quite what I want and I should have been clearer in my initial question.
I want to work out the missed jobs set but then display on the axis the name of the 'parent' advertiser but the value in the cellset should be the value of the missed jobs and NOT the value for the parent (which is what this GENERATE solution gives me).

What I mean is, if Advertiser1 has two jobs (Job11 and Job12) with values of 11 and 12 respectively and my Missed Jobs set calculates that only Job 11 applies, then I want to see "Advertiser1, 11 "on the axis.
The GENERATE approach displays "Advertiser1, 23" which is not what I am after.

Do you have any other ideas please?

With continuing thanks
Mgale1

Monday, March 26, 2012

parent/child text File Import


I have a file with a parent child records in the same file.

My game plan is to get it into a table recognize the parents and put them in the parent table and recognize the children and put them in the children table.

The problem I am having is the flat file import chokes on it because the column withs are different from line to line (parent / child).

Any thoughts or suggestions would be apprecaited.

Mardo

You'll need to import the data into the pipeline as a single wide column and then parse out the required values using a combination of the condistional split component and derived column component.

-Jamie

Friday, March 9, 2012

Parameters Layers

Hi all!
I try to make a report with a that is releated to another parameter.
Eg:
Parents Parameters
- Month1
- Month2
- Year
Children Parameters
- USD_RATE
- EUR_RATE
This query is supposed to fill my @.USD_RATE and @.EUR_RATE:
SELECT AVG(USD) AS R_USD, AVG(EUR) AS R_EUR FROM ut_ChangeRate
WHERE (MM BETWEEN @.Month1 AND @.Month2) AND (YYYY = @.Year)
And when I pressed view report I get this error msg:
The USD_RATE parameter is missing a value.
It's the same for the other paramater but I don't get the message because it
stops at the first error encounter.
PLEASE HELP!!
Thanks
JulienOn Mar 22, 3:35 pm, "Julien Bonnier" <jul...@.m0851.com> wrote:
> Hi all!
> I try to make a report with a that is releated to another parameter.
> Eg:
> Parents Parameters
> - Month1
> - Month2
> - Year
> Children Parameters
> - USD_RATE
> - EUR_RATE
> This query is supposed to fill my @.USD_RATE and @.EUR_RATE:
> SELECT AVG(USD) AS R_USD, AVG(EUR) AS R_EUR FROM ut_ChangeRate
> WHERE (MM BETWEEN @.Month1 AND @.Month2) AND (YYYY = @.Year)
> And when I pressed view report I get this error msg:
> The USD_RATE parameter is missing a value.
> It's the same for the other paramater but I don't get the message because it
> stops at the first error encounter.
> PLEASE HELP!!
> Thanks
> Julien
Did you set Default and Available values (from Query) for USD_RATE and
EUR_RATE parameters? Also, make sure that @.Month1 and @.Month2 are set
in the datasets (select 'Edit Selected Dataset' [...] button on the
Data tab and select the Parameters tab and make sure that the Value
fields (for @.Month1 and @.Month2) are set to the correct parameters).
Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||Check for "Hidden" checkbox as well, then you get this msg.
Amarnath, MCTS
"Julien Bonnier" wrote:
> Hi all!
> I try to make a report with a that is releated to another parameter.
> Eg:
> Parents Parameters
> - Month1
> - Month2
> - Year
> Children Parameters
> - USD_RATE
> - EUR_RATE
>
> This query is supposed to fill my @.USD_RATE and @.EUR_RATE:
> SELECT AVG(USD) AS R_USD, AVG(EUR) AS R_EUR FROM ut_ChangeRate
> WHERE (MM BETWEEN @.Month1 AND @.Month2) AND (YYYY = @.Year)
> And when I pressed view report I get this error msg:
> The USD_RATE parameter is missing a value.
> It's the same for the other paramater but I don't get the message because it
> stops at the first error encounter.
> PLEASE HELP!!
> Thanks
> Julien
>
>