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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply

Year over Year Data Comparison

Hi There ,

Hope you doing well,

I want to create an measure showing Year to Year Total sales in column chart however i want that calculation to pick automatically upcoming year data also e.g 2017,2018,2019,2020 and so on...

 

I am using this Dax:
Sales LY=calculate(Total[Sales],dateadd(dates(date),-1,Year))
but by this process i have to make each year measure ...So is there any formula where i can use single measure and all the years data will appear in one go 

 

I really appreicate if anyone can help me in this.

 

Regards,

Ashish 

1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @Ashish_kumar12 ,

 

First I created a calendar table.

Table = 
CALENDAR(
    MIN(Sheet2[date]),
    MAX(Sheet2[date])
)

Then I created table relationship.

v-lionel-msft_0-1605765301831.png

Then I used your measure formula.

Sales LY = 
CALCULATE(
    SUM(Sheet2[Value]),
    DATEADD( 'Table'[Date], -1, YEAR )
)

v-lionel-msft_1-1605765436209.png

 

Best regards,
Lionel Chen

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

4 REPLIES 4
v-lionel-msft
Community Support
Community Support

Hi @Ashish_kumar12 ,

 

First I created a calendar table.

Table = 
CALENDAR(
    MIN(Sheet2[date]),
    MAX(Sheet2[date])
)

Then I created table relationship.

v-lionel-msft_0-1605765301831.png

Then I used your measure formula.

Sales LY = 
CALCULATE(
    SUM(Sheet2[Value]),
    DATEADD( 'Table'[Date], -1, YEAR )
)

v-lionel-msft_1-1605765436209.png

 

Best regards,
Lionel Chen

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

v-lionel-msft
Community Support
Community Support

Hi @Ashish_kumar12 ,

 

Try this.

v-lionel-msft_0-1605164334808.png

 

Best regards,
Lionel Chen

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

Hi Lionel,

 

Thank you for your reply and the example which you showed.

Unfortunatley i am not able to open your pbix file, could you please share me Dax here if possible ?

Regards,

Ashish

lbendlin
Super User
Super User

Look at the "Quick Measures" option in Power BI, it has templates for such a scenario.

 

Make sure that you have a proper calendar table, too.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.