Jakub Truneček
Jakub Truneček

Reputation: 9000

MDX query to sum measure of items containing dimension member

This MDX query:

WITH
MEMBER [Measures].[# answered] AS
    ([Dispozice].[Dispozice].[ANSWERED], [Measures].[# hovorů])
SELECT
{[Measures].[# hovorů], [Measures].[# answered]} ON COLUMNS,
CrossJoin([Datum vytvoření.Po dnech].[Rok].[2017], [Dispozice].[Dispozice].Members) ON ROWS
FROM [Hovory]

returns this table:

enter image description here

but I need something like this:

enter image description here

I need to sum measure # hovorů only for those items that has the ANSWERED member of dimension Dispozice. I want to add this as computed measurement which will be used to calculate percantage.

Thank you very much.

Upvotes: 0

Views: 503

Answers (1)

whytheq
whytheq

Reputation: 35605

I'm guessing just using iif with a null branch is too much hard coding:

WITH
MEMBER [Measures].[# answered] AS
    iif(
      [Dispozice].CURRENTMEMBER IS [Dispozice].[Dispozice].[ANSWERED]
    , [Measures].[# hovorů]
    , NULL
    )

Upvotes: 1

Related Questions