Menu
Stuff by Yuki
  • Home
  • Data Engineering
    • Python
  • Business Intelligence
    • Power BI
    • Tableau
  • Perspectives
  • About
  • Contact
Stuff by Yuki

Year-Over-Year Calculation: Time Intelligence in Power BI

Posted on May 28, 2021September 28, 2022

Year-Over-Year Calculation With SAMEPERIODLASTYEAR

I worked on this as part of WoW 2021 Week21. I had so much fun working on this project! Not necessarily figuring out how to do Year-over-year calculations because they are made pretty easy to implement in DAX.

I thought about the design and story I wanted to tell the audience, so I customized the design a lot and tried to be creative so that the audience may better understand the trends shown in the visualization.

Here’s a Year-over-year calculation in DAX:

Connecticut Median Sale Price YoY =
VAR _samePeriodLastYear =
    CALCULATE (
        [Connecticut Median Sale Price],
        SAMEPERIODLASTYEAR ( DateDim[Date] )
    )
VAR _diff = [Connecticut Median Sale Price] - _samePeriodLastYear
RETURN
    DIVIDE ( _diff, _samePeriodLastYear )

And I also created a measure that changes color conditionally:

Color for % Diff =
IF ( [% Difference from National Median Sale Price] < 0, "#E6E6E6", "#08519C" )

Designing visuals and creating DAX measures are the funnest part of the job 😎

Data Source | Source Code

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Where I’m Headed in the Next 5 Years
  • Open-Source vs Vendor Data Tools
  • Developing the Habit of Writing
  • How to Inspect and Optimize Query Plans in Python Polars
  • Learn Python Polars with Polars Cookbook

Popular Posts

  • A Running Total Calculation with Quick Measure in Power BI
  • A Complete Guide to Git Integration in Power BI
  • How To Copy And Paste Report Page in Power BI
  • Handling Missing Values in Polars
  • How to Convert String to Date or Datetime in Polars

connect with me

  • LinkedIn
  • Twitter
  • Github
  • Website

Search Articles

©2025 Stuff by Yuki | Powered by SuperbThemes