Forum Discussion
ShivaPrasad1
Helper I
8 years agoDynamic rollback to previous 12 months based on date
Hello Team, I have date column of text format where values will be like 2017.12, 2018.01, 2018.12...I want to create a report for which I need to show last 12 months of data only. How can we achi...
- 8 years ago
Hi ShivaPrasad1
For current month, you may try below measure:
Measure = VAR a = DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, 1 ) RETURN IF ( MAX ( 'Table'[YearMonth.No] ) IN DATESINPERIOD ( 'Table'[YearMonth.No], a, -12, MONTH ), 1 )Regards,
Cherie
ShivaPrasad1
Helper I
8 years agoThanks you v-cherch-msft
But we don't have any filter to select current month. It should be change based on the current date.
Regards,
Shiva
v-cherch-msft
Microsoft Employee
8 years agoHi ShivaPrasad1
For current month, you may try below measure:
Measure =
VAR a =
DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, 1 )
RETURN
IF (
MAX ( 'Table'[YearMonth.No] )
IN DATESINPERIOD ( 'Table'[YearMonth.No], a, -12, MONTH ),
1
)Regards,
Cherie