Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Br1bn
Regular Visitor

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:

Br1bn_0-1673514982492.png

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:

Br1bn_1-1673515047007.png

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:

Br1bn_2-1673515184898.png

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

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

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.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

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.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.