Promedio de sumas en consulta MDX
Frecuentes
Visto 4,005 veces
1
How can I compute average of sums in MDX? I want to compute sum of spending for each person and then compute an average of it. I have the following query so far, but I believe it gives me wrong result:
WITH MEMBER [Measures].[Average] AS
AVG(Measures.cost)
SELECT [Measures].[Average] ON COLUMNS
FROM
( SELECT Measures.cost ON COLUMNS,
{Person.[Last name].MEMBERS}*
{Person.[First name].MEMBERS} ON ROWS
FROM Cube )
Cualquier ayuda sería muy apreciada.
2 Respuestas
0
Try to create a calculated measure for this function like this
IIF (([Measures.cost] > 0), AVG(Person.Members,Measures.cost),null)
Then use this calculated measure in your MDX query
SELECT Person, 'calculated.measure'
FROM Cube
This is only a sample code to illustrate the function.
Respondido 28 ago 12, 13:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas mdx average or haz tu propia pregunta.
The result is closer to the right value, but still not there :) The average should be between 100 and 1000, the result was slightly over 4000. - kyooryu
@kyooryu Could you check that there are no unexpected elements in
Person.[Last name].MEMBERS
? - BenoitAh, I copypasted the answer as it was, I did not notice that last name is not crossed with first name. - kyooryu