Forum Discussion
Date filtered calculation
- 4 years ago
Hi stefani_vileva ,
I downloaded your file, because Revenue is a calculated column in your file, the value of a calculated column cann't change based on the slicer, they are only calculated when you first define them and during a dataset refresh. So always for Selected Min Date it takes the lowest value of the parametar (01.01.2022) and for the maximum (31.12.2022). Refer to this article for more information: Difference between calculated columns and measures?
Here's my solution.
Create a measure.
Measure = VAR curr_date_min = DATE ( MAX ( 'Indicators'[Year] ), MONTH ( [Selected Min Date] ), DAY ( [Selected Min Date] ) ) VAR curr_date_max = DATE ( MAX ( 'Indicators'[Year] ), MONTH ( [Selected Max Date] ), DAY ( [Selected Max Date] ) ) RETURN CALCULATE ( SUM ( Sellings[Revenue] ), Sellings[Date] >= curr_date_min && Sellings[Date] <= curr_date_max )Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi stefani_vileva ,
I downloaded your file, because Revenue is a calculated column in your file, the value of a calculated column cann't change based on the slicer, they are only calculated when you first define them and during a dataset refresh. So always for Selected Min Date it takes the lowest value of the parametar (01.01.2022) and for the maximum (31.12.2022). Refer to this article for more information: Difference between calculated columns and measures?
Here's my solution.
Create a measure.
Measure =
VAR curr_date_min =
DATE ( MAX ( 'Indicators'[Year] ), MONTH ( [Selected Min Date] ), DAY ( [Selected Min Date] ) )
VAR curr_date_max =
DATE ( MAX ( 'Indicators'[Year] ), MONTH ( [Selected Max Date] ), DAY ( [Selected Max Date] ) )
RETURN
CALCULATE (
SUM ( Sellings[Revenue] ),
Sellings[Date] >= curr_date_min
&& Sellings[Date] <= curr_date_max
)
Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- stefani_vileva4 years agoResolver II
Thanks a lot. Works like a charm!