How to SUM previous value in MDX in a generic structure

Julie Gagnon 1 Reputation point
2021-03-30T19:30:11.24+00:00

Here is my structure:
DimFiscalYear
Year
Quarter
[Year Quarter] (hierarchy of Year-Quarter)

Measure
Sales amount

CREATE MEMBER CURRENTCUBE.[Measures].[Amount YOY quarter]
AS SUM({[DimFiscalYear].[Year Quarter].Lag(4):[DimFiscalYear].[Year Quarter].Lag(4)},[Measures].[Sales amount]),
VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'Measure Sales';

Result
Current YOY
2020 Q1 250000 0
2020 Q2 175000 0
2020 Q3 345000 0
2020 Q4 275000 0
2021 Q1 430000 250000
2021 Q2 145000 175000

Instead of using Lag, I would rather want to use COUSIN, but I'm not able to have a syntax that works.

Thanks

Community Center | Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ehren (MSFT) 1,781 Reputation points Microsoft Employee
    2021-04-09T21:47:26.827+00:00

    This question is related to Power BI, not Power Query. Please post it over in the Power BI Community forum.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.