Kleyson, you&#39;re using cde - instead of doing the if at mdx level, just pass the appropriate param already set<div><br></div><div><span></span><br><br>On Monday, January 28, 2013, Kleyson Rios  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
My dashboard has a combobox where the options are:<br>
- All (static one)<br>
- Desp. Medicas (come from a select)<br>
- Honorarios (come from a select)<br>
<br>
So, I need create filters based on the selection.<br>
<br>
If my user select &quot;All&quot; my MDX should be:<br>
<br>
select NON EMPTY {[Measures].[ConstStr]} ON COLUMNS, NON EMPTY<br>
 Order({[Convenio].[Todos convenios].Children},<br>
 [Measures].[Porcentagem], DESC) ON ROWS<br>
 from [Fatur]<br>
 where {[Tempo].[2011]}<br>
<br>
But if my user choose &quot;Honorarios&quot; should be:<br>
<br>
select NON EMPTY {[Measures].[ConstStr]} ON COLUMNS, NON EMPTY<br>
 Order({[Convenio].[Todos convenios].Children},<br>
 [Measures].[Porcentagem], DESC) ON ROWS<br>
 from [Fatur]<br>
 where Crossjoin({[Tempo].[2011]}, {[Tipo Despesa].[Honorario]})<br>
<br>
<br>
The same idea in SQL would be:<br>
<br>
select fields<br>
from table<br>
where case when ${type} = &#39;All&#39; then 1=1<br>
           else type = &#39;Honorarios&#39;<br>
      end<br>
<br>
<br>
<br>
I&#39;ve read a lot trying to find the answer but nothing until now.<br>
<br>
Thanks for the help.<br>
<br>
Regards.<br>
<br>
<br>
<br>
--<br>
Kleyson Rios<br>
Gestor de TI<br>
Coordenador de BI / Banco de Dados<br>
Gerência de Tecnologia da Informação<br>
Secretaria de Estado da Saúde de Goiás<br>
(62) 3201-3707<br>
<br>
Se não pode vencer pelo talento, vença pelo esforço. (Dave Weinbaum)<br>
<br>
<br>
----- Original Message -----<br>
From: &quot;Matt Campbell&quot; &lt;<a>mcampbell@pentaho.com</a>&gt;<br>
To: &quot;Mondrian developer mailing list&quot; &lt;<a>mondrian@pentaho.org</a>&gt;<br>
Sent: Friday, January 25, 2013 5:52:52 PM<br>
Subject: Re: [Mondrian] CASE/WHEN Statement in Where clause<br>
<br>
<br>
<br>
<br>
<br>
Kleyson&#39;s example didn&#39;t actually have a Boolean in the WHERE, it had a CASE statement that evaluates conditionally to a set. That&#39;s supported, although a little odd. The following query will run fine in Mondrian:<br>

<br>
<br>
<br>
select from sales WHERE<br>
<br>
case when &#39;All&#39; = &#39;All&#39; then gender.f else gender.m end<br>
<br>
<br>
<br>
Kleyson, can you give a little background on the intent of your query? There are probably more straightforward ways to construct it.<br>
<br>
<br>
<br>
<br>
<br>
-----Original Message-----<br>
From: <a>mondrian-bounces@pentaho.org</a> [mailto:<a>mondrian-bounces@pentaho.org</a>] On Behalf Of Julian Hyde<br>
Sent: Friday, January 25, 2013 2:31 PM<br>
To: Mondrian developer mailing list<br>
Subject: Re: [Mondrian] CASE/WHEN Statement in Where clause<br>
<br>
<br>
<br>
You&#39;ve read the tutorial and you still think you can put a boolean expression in the WHERE clause? Read it again.<br>
<br>
<br>
<br>
Julian<br>
<br>
<br>
<br>
<br>
<br>
On Jan 25, 2013, at 10:30 AM, Kleyson Rios &lt; <a>kleyson.rios@saude.go.gov.br</a> &gt; wrote:<br>
<br>
<br>
<br>
&gt; I Julian,<br>
<br>
&gt;<br>
<br>
&gt; Thanks for the answer.<br>
<br>
&gt;<br>
<br>
&gt; I&#39;ve already read the tutorial.<br>
<br>
&gt;<br>
<br>
&gt; I am asking because in Microsoft website I saw an example using CASE/WHEN for select.<br>
<br>
&gt;<br>
<br>
&gt; I need to use the same idea for the WHERE.<br>
<br>
&gt;<br>
<br>
&gt; Can you give me a way in how to do that ?<br>
<br>
&gt;<br>
<br>
&gt; Thanks in advance.<br>
<br>
&gt;<br>
<br>
&gt; Kleyson Rios.<br>
<br>
&gt;<br>
<br>
&gt; ----- Mensagem original -----<br>
<br>
&gt; De: &quot;Julian Hyde&quot; &lt; <a>jhyde@pentaho.com</a> &gt;<br>
<br>
&gt; Para: &quot;Mondrian developer mailing list&quot; &lt; <a>mondrian@pentaho.org</a> &gt;<br>
<br>
&gt; Enviadas: Sexta-feira, 25 de Janeiro de 2013 16:14:45<br>
<br>
&gt; Assunto: Re: [Mondrian] CASE/WHEN Statement in Where clause<br>
<br>
&gt;<br>
<br>
&gt; 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.<br>

<br>
<br>
<br>
&gt;<br>
<br>
&gt; Julian<br>
<br>
&gt;<br>
<br>
&gt;<br>
<br>
&gt; On Jan 25, 2013, at 10:12 AM, Kleyson Rios &lt; <a>kleyson.rios@saude.go.gov.br</a> &gt; wrote:<br>
<br>
&gt;<br>
<br>
&gt;&gt;<br>
<br>
&gt;&gt; Hi,<br>
<br>
&gt;&gt;<br>
<br>
&gt;&gt; Is it possible use CASE/WHEN in Where clause ?<br>
<br>
&gt;&gt;<br>
<br>
&gt;&gt; For example:<br>
<br>
&gt;&gt;<br>
<br>
&gt;&gt; select NON EMPTY {[Measures].[ConstStr]} ON COLUMNS, NON EMPTY<br>
<br>
&gt;&gt; Order({[Convenio].[Todos convenios].Children},<br>
<br>
&gt;&gt; [Measures].[Porcentagem], DESC) ON ROWS from [Fatur] where CASE WHEN<br>
<br>
&gt;&gt; &#39;All&#39; = &#39;All&#39; then {[Tempo].[2011]}<br>
<br>
&gt;&gt; ELSE Crossjoin({[Tempo].[2011]}, {[Tipo Despesa].[Honorario]})<br>
<br>
&gt;&gt; END<br>
<br>
&gt;&gt;<br>
<br>
&gt;&gt; Thanks in advance.<br>
<br>
&gt;&gt;<br>
<br>
&gt;&gt; Kleyson Rios.<br>
<br>
&gt;&gt; _______________________________________________<br>
<br>
&gt;&gt; Mondrian mailing list<br>
<br>
&gt;&gt; <a>Mondrian@pentaho.org</a><br>
<br>
&gt;&gt; <a href="http://lists.pentaho.org/mailman/listinfo/mondrian" target="_blank">http://lists.pentaho.org/mailman/listinfo/mondrian</a><br>
<br>
&gt;<br>
<br>
&gt; _______________________________________________<br>
<br>
&gt; Mondrian mailing list<br>
<br>
&gt; <a>Mondrian@pentaho.org</a><br>
<br>
&gt; <a href="http://lists.pentaho.org/mailman/listinfo/mondrian" target="_blank">http://lists.pentaho.org/ma</a></blockquote></div>