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
marsclone
Helper IV
Helper IV

DAX

Hello
I have a table with different customers,products,total sales (amount and revenue) for the years 2017 and 2018.
I made a DAX formula to calculate the average prive.
Now i want to calculate the difference between the price from 2018 with the price from 2017.
How does such DAX formula look like?

Kind regards
1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @marsclone,

 

I had a test to calculate the difference based on the data as your descripted. Please check the following steps:

 

 1.Enter the data and new a Year column using the formula:

Year = YEAR(Table2[date])

2.Create three measures to calculate that you want.

ave 2017 = CALCULATE(SUM(Table2[Revenue])/SUM(Table2[qty]), FILTER(Table2,Table2[Year]=2017))
ave 2018 = CALCULATE(SUM(Table2[Revenue])/SUM(Table2[qty]), FILTER(Table2,Table2[Year]=2018))
difference = [ave 2018]-[ave 2017]

3.Then we can get the result as below.

image001.png

 

For more information, please check the pbix as attached.

https://www.dropbox.com/s/rfdinx3zzxg9i5h/DAx1.pbix?dl=0


If the above DAX don’t help, please share sample data of your table and post expected result.

 

Regards,
Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @marsclone,

 

I had a test to calculate the difference based on the data as your descripted. Please check the following steps:

 

 1.Enter the data and new a Year column using the formula:

Year = YEAR(Table2[date])

2.Create three measures to calculate that you want.

ave 2017 = CALCULATE(SUM(Table2[Revenue])/SUM(Table2[qty]), FILTER(Table2,Table2[Year]=2017))
ave 2018 = CALCULATE(SUM(Table2[Revenue])/SUM(Table2[qty]), FILTER(Table2,Table2[Year]=2018))
difference = [ave 2018]-[ave 2017]

3.Then we can get the result as below.

image001.png

 

For more information, please check the pbix as attached.

https://www.dropbox.com/s/rfdinx3zzxg9i5h/DAx1.pbix?dl=0


If the above DAX don’t help, please share sample data of your table and post expected result.

 

Regards,
Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
marsclone
Helper IV
Helper IV

Hello
I have a table with different customers,products,total sales (amount and revenue) for the years 2017 and 2018.
I made a DAX formula to calculate the average prive.
Now i want to calculate the difference between the price from 2018 with the price from 2017.
How does such DAX formula look like?

Kind regards
Greg_Deckler
Community Champion
Community Champion

Check out my Time Intelligence The Hard Way measure in the Quick Measure Gallery.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.