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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
TiredWombat223
New Member

Line and Column Chart - YoY Trend Lines?

I am a brand new user to the platform, so apologies in advance if I've missed something obvious. I am attempting to set up a column chart showing total expenses per period (year, month, quarter) based on a selected time range. While this part isn't an issue, I am also attempting to set up a trend line that will run through the chart whlie showing YoY change from the previous year's matching unit (January 2023 vs. January 2022).

I've set up measures that calculate the total expenses for the selected period, total expenses for the same period from the previous year, and a third that calculates YoY percentage increase or decrease based on the previous two. Everything seems to work fine with those, numbers all match up with what they should be. However, when setting that up as the line y-axis variable, my line appears as below:

EQ1.png

I can see the issue is that it's taking these double digit percentages and showing them as integers, which on a y-axis scaling into the tens of thousands essentially has them all down at 0. Is there a way for me to fix this? I assume this isn't data related and rather an option I'm not aware of in the visualization settings, but I can provide further info if needed.

1 ACCEPTED SOLUTION

Awesome - thank you! Anytime you do division, use the DIVIDE DAX function, you will have better performance. For the YoY% you can utilize the quick measure. In your data pane, go to your measure Total Cost, click the 3 dots, click New quick measure.

audreygerred_0-1712693280677.png

Once that selection opens up you can choose the Year-over-year-change option:

audreygerred_1-1712693353561.png

 

 

And, add your date from the date table to the date well, then click add:

audreygerred_2-1712693408279.png

 

You'll wind up with DAX measure with this for the DAX (assuming your date table is marked as a date table, if it's not then your date portion of the measure will have 'Date'[date].[Date]) :

Total Cost YoY% =
IF(
    ISFILTERED('Date'[date]),
    ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
    VAR __PREV_YEAR = CALCULATE([Total Cost], DATEADD('Date'[date], -1, YEAR))
    RETURN
        DIVIDE([Total Cost] - __PREV_YEAR, __PREV_YEAR)
)

 

DIVIDE function (DAX) - DAX | Microsoft Learn





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

5 REPLIES 5
audreygerred
Super User
Super User

Can you share your DAX for the YoY measure? Also, I would suggust creating an explicit measure for Cost instead of using the implicit one currently in the visual.

http://powerbiwithme.com/2023/10/25/the-explicit-implicit-measure-edition/ 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thank you for the resource! I forgot to change it over to the one I've calculated, so thanks for the reminder on that as well. 

These are the 3 DAX functions at play here :

Total Cost = SUM('2022 - 2024 Expenses'[Cost])
Cost LY = CALCULATE([Total Cost], DATEADD('Calendar'[Date], -1, YEAR))
Cost YoY = ((([Total Cost] - [Cost LY]) / [Cost LY]))



Awesome - thank you! Anytime you do division, use the DIVIDE DAX function, you will have better performance. For the YoY% you can utilize the quick measure. In your data pane, go to your measure Total Cost, click the 3 dots, click New quick measure.

audreygerred_0-1712693280677.png

Once that selection opens up you can choose the Year-over-year-change option:

audreygerred_1-1712693353561.png

 

 

And, add your date from the date table to the date well, then click add:

audreygerred_2-1712693408279.png

 

You'll wind up with DAX measure with this for the DAX (assuming your date table is marked as a date table, if it's not then your date portion of the measure will have 'Date'[date].[Date]) :

Total Cost YoY% =
IF(
    ISFILTERED('Date'[date]),
    ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
    VAR __PREV_YEAR = CALCULATE([Total Cost], DATEADD('Date'[date], -1, YEAR))
    RETURN
        DIVIDE([Total Cost] - __PREV_YEAR, __PREV_YEAR)
)

 

DIVIDE function (DAX) - DAX | Microsoft Learn





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





That did it! Thank you so much for being so thorough and providing sources. Tremendous help. 

You're very welcome! I'm happy to help!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.