I would like to create a calculated measure that only summarizes a specific subset of the records in my fact table based on the dimension attribute.
Considering:
Measurement
- date of
- LedgerLineItem {Charge, Payment, Write-Off, Copay, Credit}
Measures
Relationships
* LedgerLineItem is a degenerate size of FactLedger
If I break LedgerAmount by LedgerLineItem.Type, I can easily see how much is credited, paid, credited, etc., but when I do not break it into LedgerLineItem.Type, I can not easily add credit, etc. to the pivot table. I would like to create separate calculated measures that summarize only a certain type (or several types) of accounting facts.
An example of the desired result would be:
| Year | Charged | Total Paid | Amount - Ledger |
| 2008 | $1000 | $600 | -$400 |
| 2009 | $2000 | $1500 | -$500 |
| Total | $3000 | $2100 | -$900 |
, , . , - ETL, ETL, . , MDX, - , , ETL MDX, .
, , .
, . ( [amount-bookger], , .
CREATE MEMBER CURRENTCUBE.[Measures].[Received Payment]
AS CASE WHEN ([Ledger].[Type].currentMember = [Ledger].[Type].&[Credit])
OR ([Ledger].[Type].currentMember = [Ledger].[Type].&[Paid])
OR ([Ledger].[Type].currentMember = [Ledger].[Type].&[Held Money: Copay])
THEN [Measures].[Amount - ledger]
ELSE 0
END
, FORMAT_STRING = "Currency"
, VISIBLE = 1
, ASSOCIATED_MEASURE_GROUP = 'Ledger' ;
, . , , , , , , 0 . ..
CREATE MEMBER CURRENTCUBE.[Measures].[Received Payment]
AS sum({([Ledger].[Type].&[Credit]), ([Ledger].[Type].&[Paid])
, ([Ledger].[Type].&[Held Money: Copay])}
, [Measures].[Amount - Ledger])
, FORMAT_STRING = "Currency"
, VISIBLE = 1
, ASSOCIATED_MEASURE_GROUP = 'Ledger' ;
, Ledger.Type ?