question

JulieGagnon-0419 avatar image
0 Votes"
JulieGagnon-0419 asked Ehren published

How to SUM previous value in MDX in a generic structure

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


power-query-not-supported
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Ehren avatar image
0 Votes"
Ehren answered Ehren published

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


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.