[Mondrian] CASE/WHEN Statement in Where clause

Julian Hyde jhyde at pentaho.com
Fri Jan 25 14:30:52 EST 2013


You've read the tutorial and you still think you can put a boolean expression in the WHERE clause? Read it again.

Julian


On Jan 25, 2013, at 10:30 AM, Kleyson Rios <kleyson.rios at saude.go.gov.br> wrote:

> I Julian,
> 
> Thanks for the answer.
> 
> I've already read the tutorial.
> 
> I am asking because in Microsoft website I saw an example using CASE/WHEN for select.
> 
> I need to use the same idea for the WHERE.
> 
> Can you give me a way in how to do that ?
> 
> Thanks in advance.
> 
> Kleyson Rios.
> 
> ----- Mensagem original -----
> De: "Julian Hyde" <jhyde at pentaho.com>
> Para: "Mondrian developer mailing list" <mondrian at pentaho.org>
> Enviadas: Sexta-feira, 25 de Janeiro de 2013 16:14:45
> Assunto: Re: [Mondrian] CASE/WHEN Statement in Where clause
> 
> You are making a mistake that many people make when learning MDX. You are assuming that the MDX WHERE clause has the same purpose as the SQL WHERE clause. MDX WHERE clause does not contain a boolean expression. I suggest that you read a tutorial on MDX.
> 
> Julian
> 
> 
> On Jan 25, 2013, at 10:12 AM, Kleyson Rios <kleyson.rios at saude.go.gov.br> wrote:
> 
>> 
>> Hi,
>> 
>> Is it possible use CASE/WHEN in Where clause ?
>> 
>> For example:
>> 
>> select NON EMPTY {[Measures].[ConstStr]} ON COLUMNS,
>> NON EMPTY Order({[Convenio].[Todos convenios].Children}, [Measures].[Porcentagem], DESC) ON ROWS
>> from [Fatur]
>> where 
>>  CASE WHEN 'All' = 'All' then {[Tempo].[2011]}
>>       ELSE Crossjoin({[Tempo].[2011]}, {[Tipo Despesa].[Honorario]})
>>  END 
>> 
>> Thanks in advance.
>> 
>> Kleyson Rios.
>> _______________________________________________
>> Mondrian mailing list
>> Mondrian at pentaho.org
>> http://lists.pentaho.org/mailman/listinfo/mondrian
> 
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian



More information about the Mondrian mailing list