Forum Discussion
Value based on last date
- 6 years ago
Hi Termenoque ,
Please check:
1. Create a Dates table.
Dates = ADDCOLUMNS ( CALENDAR ( DATE ( 2020, 6, 1 ), DATE ( 2020, 9, 30 ) ), "Year", YEAR ( [Date] ), "Month", MONTH ( [Date] ), "MonthName", FORMAT ( [Date], "MMM" ) )2. Sort "MonthName" column by "Month" column.
3. Create relationship between Dates table and your fact table.
4. Create measures.
MTD Average Inbound volume = TOTALMTD ( AVERAGE ( 'Table'[Inbound] ), 'Dates'[Date] )MTD Average Resolved Volume = TOTALMTD ( AVERAGE ( 'Table'[Resolved] ), Dates[Date] )Last Date = VAR LastDate_ = CALCULATE ( MAX ( 'Table'[DateResolved] ), ALLSELECTED ( 'Table' ) ) VAR LastDateMonth = MONTH ( LastDate_ ) RETURN IF ( MAX ( Dates[Month] ) = LastDateMonth, LastDate_ )Last Open Volume on last date = IF ( [Last Date] <> BLANK (), CALCULATE ( MAX ( 'Table'[Open] ), FILTER ( 'Table', 'Table'[DateResolved] = [Last Date] ) ) )No of days to clear volume based on Avg Resolved volume = [Last Open Volume on last date] / [MTD Average Resolved Volume]5. Create a Matrix visual and set value "show on rows".
BTW, .pbix file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Termenoque ,
Please check:
1. Create a Dates table.
Dates =
ADDCOLUMNS (
CALENDAR ( DATE ( 2020, 6, 1 ), DATE ( 2020, 9, 30 ) ),
"Year", YEAR ( [Date] ),
"Month", MONTH ( [Date] ),
"MonthName", FORMAT ( [Date], "MMM" )
)
2. Sort "MonthName" column by "Month" column.
3. Create relationship between Dates table and your fact table.
4. Create measures.
MTD Average Inbound volume =
TOTALMTD ( AVERAGE ( 'Table'[Inbound] ), 'Dates'[Date] )
MTD Average Resolved Volume =
TOTALMTD ( AVERAGE ( 'Table'[Resolved] ), Dates[Date] )
Last Date =
VAR LastDate_ =
CALCULATE ( MAX ( 'Table'[DateResolved] ), ALLSELECTED ( 'Table' ) )
VAR LastDateMonth =
MONTH ( LastDate_ )
RETURN
IF ( MAX ( Dates[Month] ) = LastDateMonth, LastDate_ )
Last Open Volume on last date =
IF (
[Last Date] <> BLANK (),
CALCULATE (
MAX ( 'Table'[Open] ),
FILTER ( 'Table', 'Table'[DateResolved] = [Last Date] )
)
)
No of days to clear volume based on Avg Resolved volume =
[Last Open Volume on last date] / [MTD Average Resolved Volume]
5. Create a Matrix visual and set value "show on rows".
BTW, .pbix file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Icey Thanks for your help - got it to work eventually 🙂