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
diegoleonm
Frequent Visitor

YTD Performance Comparison Only if Current Quarter Has Data

Hi everyone,

 

I have a dataset that contains the following columns:

account(string), year(string), quarter(string), revenue(number).

 

I created a matrix with year and quarter as columns, account as the row, and sum of revenue as the values.

 

What I want to do is at the end of the matrix (last column) have one more column that compares year to date revenue with the last year.

 

For example, my dataset has revenue data from 2023 and 2024, so the last column should give me a % increase/decrease in each account's revenue only if the current year already has data (in this case would be Q1 and Q2), and as we have Q3 results, that column considers that data as well.

 

Any ideas?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @diegoleonm ,

 

You can try formula like below to create measure:

CurrentYearYTDRevenue = 
CALCULATE(
    SUM('YourDataset'[revenue]),
    DATESYTD('DateTable'[Date], "31/12"),
    'YourDataset'[Year] = YEAR(TODAY())
)
PreviousYearYTDRevenue = 
CALCULATE(
    SUM('YourDataset'[revenue]),
    DATESYTD('DateTable'[Date], "31/12"),
    'YourDataset'[Year] = YEAR(TODAY()) - 1
)
YTDPerformance = 
IF (
    [CurrentYearYTDRevenue] = 0,
    BLANK(),
    DIVIDE (
        [CurrentYearYTDRevenue] - [PreviousYearYTDRevenue],
        [PreviousYearYTDRevenue],
        0
    )
)

vkongfanfmsft_0-1721786642242.png

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @diegoleonm ,

 

You can try formula like below to create measure:

CurrentYearYTDRevenue = 
CALCULATE(
    SUM('YourDataset'[revenue]),
    DATESYTD('DateTable'[Date], "31/12"),
    'YourDataset'[Year] = YEAR(TODAY())
)
PreviousYearYTDRevenue = 
CALCULATE(
    SUM('YourDataset'[revenue]),
    DATESYTD('DateTable'[Date], "31/12"),
    'YourDataset'[Year] = YEAR(TODAY()) - 1
)
YTDPerformance = 
IF (
    [CurrentYearYTDRevenue] = 0,
    BLANK(),
    DIVIDE (
        [CurrentYearYTDRevenue] - [PreviousYearYTDRevenue],
        [PreviousYearYTDRevenue],
        0
    )
)

vkongfanfmsft_0-1721786642242.png

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you that works!

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.