Forum Discussion

Br1bn's avatar
Br1bn
Regular Visitor
3 years ago
Solved

YoY Comparison

Hi, I would create a visualization to compare performances over time so I created a calculated measurement 

 

 

TotalSpent_PY = 
CALCULATE (
    [Total Spent],
    OFFSET (
        -1,
        ALLSELECTED ( Data[YEAR] ),
        ORDERBY ( Data[YEAR], ASC )
    )
)

 

 

And this is the result:

The problem is that I would focus my view on a specific year (and the previous one), in that case using slicer I got this:

The only way to have it working is selecting two years and I would avoid it because users can select more than 2 years.

The final objective is getting something like:

I've tried several way (including a measurement like 

 

 

CALCULATE (SUM(), SAMEPERIODLASTYEAR)

 

 

But It is the same.

The only solution I have in mind is to create a pre-built filter with years combination (more complicated to be managed), but I don't know how to do it, someone colud help?

Thanks

 

 

  • Hi,

    I am not sure how your Calendar table is configured, but please try using ALL DAX function in the measure, instead of using ALLSELECTED DAX function.

1 Reply

  • Hi,

    I am not sure how your Calendar table is configured, but please try using ALL DAX function in the measure, instead of using ALLSELECTED DAX function.