Hi,
I have a crosstab with rows 1 and 2 and column A and B.
The value under the column B depend on the value under the column A but not form rows 1 and 2 items.
A B
1 2
B value should be:
if (A > 3) then (B) else (C calculated independently from rows 1 and 2)
any suggestions?
Thanks
Quote from: g.congnos on 18 Dec 2013 08:57:32 AM
Hi,
I have a crosstab with rows 1 and 2 and column A and B.
The value under the column B depend on the value under the column A but not form rows 1 and 2 items.
A B
1 2
B value should be:
if (A > 3) then (B) else (C calculated independently from rows 1 and 2)
any suggestions?
Thanks
Sorry - that doesn't seem to make sense. When you refer to "A" in "if (A > 3) are you referring to the value in cell A1? A2? The summary for the A column? The caption (label) for the A column?
Are you using a relational package or a dimensional package?
MF.
e.g.
Age Salary
Surname1 Name1
Surname2 Name2
if (Age > 30 ) then (Salary of Surname-Name) Else ( AVG(salary))
I'm using a dimensional package
Thanks
Add a new column as a query calculation (called AvgSalary) with the expression average([Salary] within set [Your set of people in the rows])
Then add another new column as a query calculation with the expression if (tuple(currentMember([Your people hierarchy]),[Age]) < 30) then ([Salary]) else ([AvgSalary])
Does this give you what you need?
MF.
I got the following error
Invalid coercion from 'string' to 'hierarchy' for '[Surname]' in 'if (tuple(currentMember([Surname],[Name]),[Age]) < 30) then ([Salary]) else ([AvgSalary])'.
do you have any suggestions to solve it?
Thanks
Hi,
Yep - you used [Surname],[Name] in the currentMember() function instead of the hierarchy the surname/name comes from.
Drag in the hierarchy object instead - in my example I tried to show this with [Your people hierarchy]
You also seem to be missing a close bracket for the currentMember() function - compare what you coded with my example
MF.
Hi,
I'm sorry, i haven't got it. I'm a beginner.
what would you write instead of [Surname],[Name] ?
Thanks
In your package you have dimensions. Within each dimension is at least one hierarchy. Grab the hierarchy your name info comes from and drop it into the currentMember() function.
(https://image.ibb.co/cu94ua/Hierarchy_zpsa040022b.png)
In the image above you can see the icon to look for
MF.