Forum Discussion
Value Calculation between relative dates
- Anonymous3 years ago
Hi Procito0o ,
You can try below measure to get the previous month value.
PreviousMonthValue = CALCULATE(SUM('Table'[Values]),FILTER(ALLSELECTED('Table'),[Users]=MAX('Table'[Users])),PREVIOUSMONTH('Table'[Dates]))Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Firstly, ensure that the "Dates" column is recognized as date type. If not, you will need to convert it. You can do this using the Power Query Editor, or by simply changing the data type in the Fields pane.
Then create a measure to get the sum of values for the current month:
Current Month Total =
CALCULATE(
SUM('Table'[Values]),
'Table'[Dates] >= EOMONTH(TODAY(), -1) + 1,
'Table'[Dates] <= EOMONTH(TODAY(), 0)
)
This measure will calculate the sum of "Values" for all dates within the current month.
Then create another measure to get the sum of values for the previous month:
Previous Month Total =
CALCULATE(
SUM('Table'[Values]),
'Table'[Dates] >= EOMONTH(TODAY(), -2) + 1,
'Table'[Dates] <= EOMONTH(TODAY(), -1)
)
This measure will calculate the sum of "Values" for all dates within the previous month.
- Put the "Current Month Total" measure in the "Value" field.
- Put the "Previous Month Total" measure in the "Target Value" field.
This will provide a comparison of the total value for the current month versus the previous month.