cancel
Showing results for
Did you mean: Frequent Visitor

Comparing latest value to previous

Hi There,

I am trying to compare latest value for each area(North, East e.t.c) to previous month value to see if it is more, and also trying to see if latest value is more than the target. i.e.

1. In the "North" the latest month value is greater than target
2. In the "North" the Difference between current month and previous month is ...
3. Value for previous month in the "North" is...

I there a way I can go about doing this with measures? Really appretiate the help

Victor

Below is what the original data looks like

 Viewings Target Apr May Jun Jul Aug Sep North 40 40 34 55 40 30 South 50 33 22 87 45 60 East 40 34 23 65 44 56 55 West 60 76 66 87 65 78
1 ACCEPTED SOLUTION  Community Support

Hi, @Alumanah

1. 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.

3 REPLIES 3  Community Support

Hi, @Alumanah

1. 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. Frequent Visitor

Thank you so much this is perfect for what I am trying to acomplish  Super User

please provide data in text format.

If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!  