﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Data Warehousing / Analysis Services  / MDX query help IF/IIF statement / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 17 Jun 2013 22:56:31 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: MDX query help IF/IIF statement</title><link>http://www.sqlservercentral.com/Forums/Topic1351259-17-1.aspx</link><description>In your cube, how do you know if something is open or closed?  You must have a dimension that describes the status.  Where is that?  That's what you'd put in your slicer.Rob</description><pubDate>Tue, 09 Oct 2012 05:53:21 GMT</pubDate><dc:creator>robert.gerald.taylor</dc:creator></item><item><title>RE: MDX query help IF/IIF statement</title><link>http://www.sqlservercentral.com/Forums/Topic1351259-17-1.aspx</link><description>@Status is a report variable that determines if I need to filter by open date or resolved/closed date.  @Status is not contained in the cube.</description><pubDate>Wed, 29 Aug 2012 13:19:59 GMT</pubDate><dc:creator>whenriksen</dc:creator></item><item><title>RE: MDX query help IF/IIF statement</title><link>http://www.sqlservercentral.com/Forums/Topic1351259-17-1.aspx</link><description>What are these things that are opened or closed?  Sales orders? Estimates? Claims?  ([i]I guess it really doesn't matter, but it helps me wrap my head around the probem if it's more concrete[/i])In what dimension is your Status stored?  Wouldn't it just be a matter of putting that in your slicer? (WHERE clause)Something like:[code="plain"]WHERE   (      [WhateverItIs].[Status].@[Closed]   )[/code]Of course this depends on how your dimension and hirearchies are setup.  I hope this isn't so general as to not be of help.HTH,Rob</description><pubDate>Wed, 29 Aug 2012 13:12:51 GMT</pubDate><dc:creator>robert.gerald.taylor</dc:creator></item><item><title>MDX query help IF/IIF statement</title><link>http://www.sqlservercentral.com/Forums/Topic1351259-17-1.aspx</link><description>I'm converting a report from a TSQL dataset to use a SSAS dataset.The report has a status parameter to choose Open or Closed items.If open is chosen, the filter will need to use the Opened field.  When closed is selected, I need to filter the result set by Closed, or Resolved if the item is not closed.  Also, the default Closed value is '19000101', nulls are not allowed.I'm hoping I can simplify the closed filter by merging the Resolved/Closed dates, using Resolved only if the Closed date is '19000101'.  I need to create the MDX equivalent, but am new to MDX and not sure how to do it.  I assume I'll need to use IIF in a calculated member to check a value and choose a dimension member based on the result.Here is the equivalent filter in SQL.  Any help would be appreciated.[code="sql"]          WHERE ( @Status = 'O'                  AND CTE.Opened BETWEEN @StatusFromDate                                 AND     @StatusToDate                  AND cte.Resolved = '19000101' --Not Resolved                )                OR @Status = 'C'                AND ( ( CTE.Resolved BETWEEN @StatusFromDate                                     AND     @StatusToDate                        AND CTE.Closed = '19000101' --Not Closed                      )                      OR Cte.Closed BETWEEN @StatusFromDate                                    AND     @StatusToDate                    )[/code]</description><pubDate>Tue, 28 Aug 2012 14:33:33 GMT</pubDate><dc:creator>whenriksen</dc:creator></item></channel></rss>