V.Bravo V.Bravo - 1 month ago 7
MySQL Question

How to Convert SQL query with Where condition and case to MDX

Im new to MDX and I also reviewed the SQL to MDX Query comparison. But still Im not able to get the hang of MDX.

I'm trying to convert the below SQL to MDX.

SELECT CAST(A.Num AS FLOAT)/A.Denom AS "Denial Rate"
FROM (
SELECT COUNT(CASE WHEN LargestAdjustmentType = 'Denial' THEN LargestAdjustmentType end) AS Num, COUNT(*) AS Denom FROM vwremits) a


Ive writtrying to write as MDX

Select [Measures].[Denial Rate]
AS [Measures].[Count] AS [AdjustmentType].["Denial"]


Could you please help me.

Answer

Without seeing what measures & hierarchies exist in your cube structure this question is impossible to answer - so here is a stab in the dark:

WITH [Measures].[Denial Rate] AS
     [Measures].[Count]
SELECT
 {} ON 0,
 [Measures].[Denial Rate] ON 1
FROM [CubeName]
WHERE [AdjustmentType].[AdjustmentType].[Denial];

Or just:

SELECT
 [AdjustmentType].[AdjustmentType].[Denial] ON 0,
 [Measures].[Count] ON 1
FROM [CubeName];
Comments