Forum Discussion
Get the Max Available Month on Selection
- 1 year ago
Hi vin26 -Create a Measure to Get the Max Available Month for Each Employee
Max Available Month =
CALCULATE(
MAX(Table1[Month]),
FILTER(
ALL(Table1),
Table1[EMP ID] = MAX(Table1[EMP ID]) && Table1[Month] <= MAX('DimDate'[Month])
)
)Measure for last 6 months calc.
Average Last 6 Months =
CALCULATE(
AVERAGE(Table1[Amount]),
DATESINPERIOD(
'DimDate'[Month],
[Max Available Month],
-6,
MONTH
),
Table1[Amount] <> BLANK()
)check with above measures, if still issue exist please share the pbix file by removing the sensitive data.
- Anonymous1 year ago
Hi vin26
Please try this:
Maybe you can delete the relationship between the Table1 and the DimDate:Then add a measure:
MEASURE = VAR _slicer = MONTH ( MAX ( 'DimDate'[Month] ) ) RETURN CALCULATE ( AVERAGE ( 'Table'[Amount] ), FILTER ( ALLSELECTED ( 'Table' ), MONTH ( 'Table'[Month] ) < _slicer && MONTH ( 'Table'[Month] ) >= _slicer - 6 ) )Then add a slicer with DimDate[Month]:
The result is as follow:
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi vin26
Please try this:
Maybe you can delete the relationship between the Table1 and the DimDate:
Then add a measure:
MEASURE =
VAR _slicer =
MONTH ( MAX ( 'DimDate'[Month] ) )
RETURN
CALCULATE (
AVERAGE ( 'Table'[Amount] ),
FILTER (
ALLSELECTED ( 'Table' ),
MONTH ( 'Table'[Month] ) < _slicer
&& MONTH ( 'Table'[Month] ) >= _slicer - 6
)
)
Then add a slicer with DimDate[Month]:
The result is as follow:
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.