2016-04-18 19 views
1

Ich habe einen Finanzbericht in SSRS, der von einer MDX-Abfrage abläuft. Der Bericht wird ausgeführt, nach Excel exportiert und dann in ein Finanzsystem wie SAP geladen.SSRS/MDX - Extra Zeile für Stornobeladung

Ich muss eine Zeile "Umkehrung" für Gebühren, die in einer bestimmten Kategorie fallen. Zum Beispiel (unten) für alles, was einen "Typ" von "Produktfracht" hat, möchte ich auch eine EXTRA-Zeile mit einem NEGATIVEN Wert einschließen, die die Ladung im Bericht im Wesentlichen umkehrt.

Dies:

| Charge   | Account | Type   | Invoice | GST | 
|------------------|---------|-----------------|---------|-----| 
| Apple   | 123  | Product   | $100 | $10 | 
| Banana   | 123  | Product   | $200 | $20 | 
| Orange   | 456  | Product   | $150 | $15 | 
| Orange (Freight) | 456  | Product Freight | $50  | 0 | 

Würde dies geworden:

| Charge   | Account | Type   | Invoice | GST | 
|------------------|---------|-----------------|---------|-----| 
| Apple   | 123  | Product   | $100 | $10 | 
| Banana   | 123  | Product   | $200 | $20 | 
| Orange   | 456  | Product   | $150 | $15 | 
| Orange   | 456  | Product Freight | $50  | 0 | 
| Orange (Freight) | 456  | Product Freight | ($50) | 0 | 

UPDATE

Dies ist eine einfache Version der MDX-Abfrage:

WITH MEMBER measures.[Charge] AS 
    [Charge].[Charge All].CurrentMember .member_name 

MEMBER measures.[Account] AS 
    [Account].[Account All].CurrentMember .member_name 

MEMBER measures.[ChargeType] AS 
    [Charge Type].[Charge Type Group].CurrentMember .member_name 

MEMBER measures.[GST] AS 
    ([Charge Type].[Charge Type Class].&[GST], measures.[value]) 

MEMBER measures.[InvExcGST] AS 
    measures.[Value] - measures.[GST] 

SELECT 
{ 
measures.[Charge], 
measures.[Account], 
measures.[ChargeType], 
measures.[InvExcGST], 
measures.[GST] 
} 
ON 0, 

NON EMPTY 
[Charge].[Charge All].[All].Children * 
[Account].[Account all].[all].Children * 
[Charge Type].[Charge Type Group].[All].Children 
HAVING measures.[Value] <> 0 
ON 1 

FROM CubeName 
+0

Können Sie bitte den aktuellen MDX hinzufügen? – whytheq

+1

Ich habe die Frage mit einer MDX-Abfrage aktualisiert – TaylorN

Antwort

1

denke ich, die folgenden werden die Zielzeilen duplizieren - immer noch nicht sicher, wie die negative Maßnahme hinzuzufügen:

WITH 
MEMBER [measures].[Charge] AS 
    [Charge].[Charge All].CurrentMember.member_name 
MEMBER [measures].[Account] AS 
    [Account].[Account All].CurrentMember.member_name 
MEMBER [measures].[ChargeType] AS 
    [Charge Type].[Charge Type Group].CurrentMember.member_name 
MEMBER [measures].[GST] AS 
    ( 
    [Charge Type].[Charge Type Class].&[GST] 
    , [measures].[value] 
) 
MEMBER [measures].[InvExcGST] AS 
    [measures].[Value] - [measures].[GST] 
SET [AllCombos] AS 
    NonEmpty(
    [Charge].[Charge All].[All].Children 
    *[Account].[Account all].[all].Children 
    *[Charge Type].[Charge Type Group].[All].Children 
    ,[measures].[Value] 
) 
SET [AllCombosFilter] AS 
    FILTER(
    [AllCombos] AS S 
    ,S.ITEM(0).ITEM(2) 
     IS [Charge Type].[Charge Type Group].[Charge Type Group].&[Product Freight] 
) 
SELECT 
    { 
    [measures].[Charge], 
    [measures].[Account], 
    [measures].[ChargeType], 
    [measures].[InvExcGST], 
    [measures].[GST] 
    } 
    ON 0, 
NON EMPTY 
    UNION([AllCombos], [AllCombosFilter], ALL) ON 1 
FROM CubeName;