Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I have Table[date], Table[salary]. I don't have any other table.
1-I want to calculate the sum of salary for last 12 months from today(May 2023 to May 2024)
2-Then, calculate the sum of salary for last 12 months of the fisrt measure (May 2022 to May 2023).
So, I would be able to compare the 2 measures.
Thanks!
Solved! Go to Solution.
It depends, @lbendlin gives you a good solution. But I would prefer to use something like this:
CALCULATE(SUM(Table[salary]),DATESBETWEEN(Table[date],DATE(2023,5,1),DATE(2024,4,30)))
and do very much the same with 2022 and 2023. this will have static values but (in my experience with data) could be very confusing for managers and people that the measure change through time.
Hope this was useful to you. And sorry for my grammar mistooks, I still learning english.
Kind regards.
It depends, @lbendlin gives you a good solution. But I would prefer to use something like this:
CALCULATE(SUM(Table[salary]),DATESBETWEEN(Table[date],DATE(2023,5,1),DATE(2024,4,30)))
and do very much the same with 2022 and 2023. this will have static values but (in my experience with data) could be very confusing for managers and people that the measure change through time.
Hope this was useful to you. And sorry for my grammar mistooks, I still learning english.
Kind regards.
sounds good. What have you tried and where are you stuck?
I have try this, but it is not working.
Last12MonthsPrior =
VAR date1 = TODAY()
VAR result =
CALCULATE (
[Last12MonthsSalary],
ALLSELECTED (),
'Table'[DATE] <= date1,
'Table'[DATE]
>= DATE ( YEAR (date1) - 1, MONTH (date1), DAY (date1) )
)
RETURN
result
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
69 | |
35 | |
21 | |
18 | |
15 |
User | Count |
---|---|
127 | |
32 | |
27 | |
24 | |
22 |