The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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]
Thank you!
Solved! Go to Solution.
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]
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.
Thank you, i reached the solution with a similar method so i accept your comment as solution!
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]
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.
Thanks, but delta so calculated is not dynamic with changing dates on filter.
I have this kind of filter
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
User | Count |
---|---|
65 | |
62 | |
60 | |
53 | |
30 |
User | Count |
---|---|
181 | |
83 | |
68 | |
49 | |
46 |