Forum Discussion
Comparing latest value to previous
- 4 years ago
Hi, Anonymous
- For your first question, check whether the value of this month is greater than the target value, create a calculation column "Compare Target", if it exceeds the target value, output Yes, otherwise No.
Compare Target = IF ( CALCULATE ( MIN ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Viewings] = EARLIER ( 'Table'[Viewings] ) && 'Table'[Attribute] = EARLIER ( 'Table'[Attribute] ) ) ) > 'Table'[Target], "Yes", "No" )2. For your second question, calculate the difference between the current month and the previous month. First create calculation columns to calculate the value of the previous month corresponding to each month in each region, and then calculate the difference.
Last Month = DATEADD ( 'Table'[Attribute], -1, MONTH )Last Mouth Value = CALCULATE ( MIN ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Attribute] = EARLIER ( 'Table'[Last Month] ) && 'Table'[Viewings] = EARLIER ( 'Table'[Viewings] ) ) )Difference Value = 'Table'[Value] - 'Table'[Last Mouth Value]The process of calculating the difference is shown in the figure:
3. If you want to compare whether there are more values than last month, you can create a calculation column "Compare Last Month Value". If there are more values than last month, you will output Yes, otherwise, you will No.
Compare Last Mouth Value = IF ( CALCULATE ( MIN ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Attribute] = EARLIER ( 'Table'[Last Month] ) && 'Table'[Viewings] = EARLIER ( 'Table'[Viewings] ) ) ) < 'Table'[Value], "Yes", "No" )Best Regards,
Charlotte Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Anonymous
- For your first question, check whether the value of this month is greater than the target value, create a calculation column "Compare Target", if it exceeds the target value, output Yes, otherwise No.
Compare Target =
IF (
CALCULATE (
MIN ( 'Table'[Value] ),
FILTER (
'Table',
'Table'[Viewings] = EARLIER ( 'Table'[Viewings] )
&& 'Table'[Attribute] = EARLIER ( 'Table'[Attribute] )
)
) > 'Table'[Target],
"Yes",
"No"
)
2. For your second question, calculate the difference between the current month and the previous month. First create calculation columns to calculate the value of the previous month corresponding to each month in each region, and then calculate the difference.
Last Month =
DATEADD ( 'Table'[Attribute], -1, MONTH )
Last Mouth Value =
CALCULATE (
MIN ( 'Table'[Value] ),
FILTER (
'Table',
'Table'[Attribute] = EARLIER ( 'Table'[Last Month] )
&& 'Table'[Viewings] = EARLIER ( 'Table'[Viewings] )
)
)
Difference Value =
'Table'[Value] - 'Table'[Last Mouth Value]
The process of calculating the difference is shown in the figure:
3. If you want to compare whether there are more values than last month, you can create a calculation column "Compare Last Month Value". If there are more values than last month, you will output Yes, otherwise, you will No.
Compare Last Mouth Value =
IF (
CALCULATE (
MIN ( 'Table'[Value] ),
FILTER (
'Table',
'Table'[Attribute] = EARLIER ( 'Table'[Last Month] )
&& 'Table'[Viewings] = EARLIER ( 'Table'[Viewings] )
)
) < 'Table'[Value],
"Yes",
"No"
)
Best Regards,
Charlotte Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous4 years agoNot applicable
Thank you so much this is perfect for what I am trying to acomplish