SQLServerCentral.com / Reporting Services / Reporting Services 2008 Development / Can MDX Case statement do this? / Latest PostsInstantForum.NET v99.99.99SQLServerCentral.comhttp://www.sqlservercentral.com/Forums/notifications@sqlservercentral.comFri, 09 Dec 2016 20:20:47 GMT20RE: Can MDX Case statement do this?http://www.sqlservercentral.com/Forums/Topic1547070-1633-1.aspx[quote]My only other alternative is to add create 60 fact rows for each existing row, which creates its own set of problems...[/quote]It's not clear to me why you'd do this, unless you mean in another fact table that would then of course have a different level of granularity. My sole caution is that the correct level of granularity for a fact table is crucial. If you don't have a clear grain and then violate it, your cube will produce incorrect data in certain cases.Thu, 06 Mar 2014 08:14:31 GMTRonKyleRE: Can MDX Case statement do this?http://www.sqlservercentral.com/Forums/Topic1547070-1633-1.aspxThanks for your reply. I inadvertently left out the fact that the cube is going to be the source for reports surfaced in PowerPivot and PerformancePoint. My idea was that the report developers would implement the case statement in their filtering/retrieval of the cube's data. Can the MDX case statement be used this way?My only other alternative is to add create 60 fact rows for each existing row, which creates its own set of problems...TIA,MikeWed, 05 Mar 2014 11:36:19 GMTMike Austin-398977RE: Can MDX Case statement do this?http://www.sqlservercentral.com/Forums/Topic1547070-1633-1.aspx[quote][b]Mike Austin-398977 (3/3/2014)[/b][hr]All,I have developed a cube that tracks the timeliness of certain steps in a business process. Steps are on time if the number of days between 2 dates is &lt;= values that are stored in a table. The fact table for the cube is assigned a Timeliness dimension ID accordingly.In addition, the users want to be able to play with the results by being able to dynamically enter a cutoff day value. To accommodate this, I have a column in the fact table, called "ElapsedDays" that is the difference between the two dates. My plan was to use this column with a parameter to re-calculate the timeliness dimension. The T-SQL logic would be as follows:CASE WHEN ElapsedDays &lt;= @parameter THEN 1 -- On time WHEn ElapsedDays &gt; @parameter THEN 2 -- Late ELSE 3 -- UnknownEND AS TimelinessDimIDIn essence, I want to substitute my new dimension values for the old ones.[/quote]Yes, you can create a calculated member. Take a look at:[url]http://technet.microsoft.com/en-us/library/ms146017(v=sql.105).aspx[/url][url]http://technet.microsoft.com/en-us/library/ms144841(v=sql.105).aspx[/url]If you have the Adventure Works cube, you can try something like:[code="sql"]WITH MEMBER [Measures].x ASCASE WHEN [Measures].[Order Count] &lt; 100 THEN 'Low' WHEN [Measures].[Order Count] &lt; 300 THEN 'Medium' ELSE 'Large'ENDSELECT { [Date].[Calendar].[Month] } ON ROWS, { [Measures].[Order Count], [Measures].x } ON COLUMNSFROM [Adventure Works];[/code]Not exactly what you asked for -- but you should get the idea.I hope this helps,RobTue, 04 Mar 2014 14:16:23 GMTrobert.gerald.taylorCan MDX Case statement do this?http://www.sqlservercentral.com/Forums/Topic1547070-1633-1.aspxAll,I have developed a cube that tracks the timeliness of certain steps in a business process. Steps are on time if the number of days between 2 dates is &lt;= values that are stored in a table. The fact table for the cube is assigned a Timeliness dimension ID accordingly.In addition, the users want to be able to play with the results by being able to dynamically enter a cutoff day value. To accommodate this, I have a column in the fact table, called "ElapsedDays" that is the difference between the two dates. My plan was to use this column with a parameter to re-calculate the timeliness dimension. The T-SQL logic would be as follows:CASE WHEN ElapsedDays &lt;= @parameter THEN 1 -- On time WHEn ElapsedDays &gt; @parameter THEN 2 -- Late ELSE 3 -- UnknownEND AS TimelinessDimIDIn essence, I want to substitute my new dimension values for the old ones.Can this be done in MDX?TIA,MikeMon, 03 Mar 2014 12:58:55 GMTMike Austin-398977