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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Delta that get dates from date filter

Hello, I would like to calculate the delta for 2023 versus 2022 and for 2024 versus 2023.
Specifically if I select from the date filter, only the months January and February of both years, how do I calculate the delta for only these two months?
In a nutshell I want the date filter to command on the calculated delta measure/column.

What calculated measure/column should I write in Power BI?

Data:
Time[Year], Time[Month]
PV[Store]
SD[Sold]


userpien_0-1717659106531.png

 

Thank you!





1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,@Anonymous 
I am glad tp help you.

Based on your description, you can try my test results below

Filtering by fields in the matrix or in the table itself makes the DAX code easy.

Here is my DAX code.

M_CurrentSold = 
CALCULATE(SUM('SD'[Sold]))
M_previousSold = 
CALCULATE(SUM('SD'[Sold]),DATEADD('Time'[Date],-1,YEAR))
M_result = 
[M_CurrentSold]-[M_previousSold]

vjtianmsft_0-1717730859702.png

 

vjtianmsft_1-1717730868371.png

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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

3 REPLIES 3
Anonymous
Not applicable

Thank you, i reached the solution with a similar method so i accept your comment as solution!

Anonymous
Not applicable

Hi,@Anonymous 
I am glad tp help you.

Based on your description, you can try my test results below

Filtering by fields in the matrix or in the table itself makes the DAX code easy.

Here is my DAX code.

M_CurrentSold = 
CALCULATE(SUM('SD'[Sold]))
M_previousSold = 
CALCULATE(SUM('SD'[Sold]),DATEADD('Time'[Date],-1,YEAR))
M_result = 
[M_CurrentSold]-[M_previousSold]

vjtianmsft_0-1717730859702.png

 

vjtianmsft_1-1717730868371.png

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

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

Anonymous
Not applicable

Thanks, but delta so calculated is not dynamic with changing dates on filter.

I have this kind of filter

userpien_0-1717774419019.png

If I want to display the delta between May 2024 and March 2023, for the year 2024 it will display the delta between May 2024 and May 2023, not for the range I selected in the filter (May2024 and March 2023). How can I modify the query so that the filter controls on the delta to be displayed? Thank you so much

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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