Forum Discussion
Check if column has same value for all dates
Hi RMarston create a measure to sum the shipments for the closed months, current month and rolling calculation as follows ,use the rolling r3 measure in your visualization.
Measure_ClosedShipments =
CALCULATE(
SUM([Case Shipments 9L]),
FILTER(
'Date',
'Date'[ShipMoClosed] = "Closed"
)
)
then create another measure for calculation when the month is not fully closed
Measure_CurrentMonthCalculation =
IF (
COUNTROWS (
FILTER (
CALENDAR ( STARTOFMONTH ( 'Date'[Date] ), ENDOFMONTH ( 'Date'[Date] ) ),
WEEKDAY ( [Date], 2 ) < 6
&& [Date]
<= MAX ( ShipmentsDataThru[Shipment Through] ) - 1
)
) > 7,
ROUND (
(
SUM ( [Case Shipments 9L] )
/ COUNTROWS (
FILTER (
CALENDAR ( STARTOFMONTH ( 'Date'[Date] ), ENDOFMONTH ( 'Date'[Date] ) ),
WEEKDAY ( [Date], 2 ) < 6
&& [Date]
<= MAX ( ShipmentsDataThru[Shipment Through] ) - 1
)
)
)
* COUNTROWS (
FILTER (
CALENDAR ( STARTOFMONTH ( 'Date'[Date] ), ENDOFMONTH ( 'Date'[Date] ) ),
WEEKDAY ( [Date], 2 ) < 6
)
),
0
),
SUM([Case Shipments 9L])
)
Create final measure for rolling 3 months sum calculation
Measure_R3 =
VAR CurrentMonth = MAX('Date'[Date])
VAR TwoMonthsAgo = EOMONTH(CurrentMonth, -2)
VAR ClosedMonthsSum =
CALCULATE(
[Measure_ClosedShipments],
DATESBETWEEN('Date'[Date], TwoMonthsAgo, EOMONTH(CurrentMonth, -1))
)
VAR CurrentMonthSum =
CALCULATE(
[Measure_CurrentMonthCalculation],
FILTER(
'Date',
'Date'[ShipMoClosed] <> "Closed"
&& MONTH('Date'[Date]) = MONTH(CurrentMonth)
&& YEAR('Date'[Date]) = YEAR(CurrentMonth)
)
)
RETURN
ClosedMonthsSum + CurrentMonthSum
use the above R3 measure in your matrix visual, this correctly sums the actual and previous closed months values.
Check and let know.
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
This does not result in the correct calculation it shows only the rolling total with the previous two months closed and does not include the Run Rate Month. I think this is because we are saying <>"Closed" but in reality there are two values in the current month: Closed and In Month