Forum Discussion
Rolling Period
- Anonymous2 years ago
Hi, kalpesh07
Thanks for bhanu_gautam reply. Here is the complementary method, which still primarily utilizes the time-intelligent function.Measure:
%Sales = VAR _dateEnd = SELECTEDVALUE ( 'Table'[Date] ) VAR _dateEndDay = DAY ( _dateEnd ) + 1 VAR _dateStart = EOMONTH ( _dateEnd, -13 ) + _dateEndDay VAR _monthStart = EOMONTH ( _dateEnd, -2 ) + _dateEndDay VAR _TotalSales = CALCULATE ( SUM ( 'Table'[Sales] ), 'Table'[Date] >= _dateStart && 'Table'[Date] <= _dateEnd ) VAR _MonthSales = CALCULATE ( SUM ( 'Table'[Sales] ), 'Table'[Date] >= _monthStart && 'Table'[Date] <= _dateEnd ) VAR _result = DIVIDE ( _MonthSales, _TotalSales ) RETURN _resultBest Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi, kalpesh07
Thanks for bhanu_gautam reply. Here is the complementary method, which still primarily utilizes the time-intelligent function.
Measure:
%Sales =
VAR _dateEnd =
SELECTEDVALUE ( 'Table'[Date] )
VAR _dateEndDay =
DAY ( _dateEnd ) + 1
VAR _dateStart =
EOMONTH ( _dateEnd, -13 ) + _dateEndDay
VAR _monthStart =
EOMONTH ( _dateEnd, -2 ) + _dateEndDay
VAR _TotalSales =
CALCULATE (
SUM ( 'Table'[Sales] ),
'Table'[Date] >= _dateStart
&& 'Table'[Date] <= _dateEnd
)
VAR _MonthSales =
CALCULATE (
SUM ( 'Table'[Sales] ),
'Table'[Date] >= _monthStart
&& 'Table'[Date] <= _dateEnd
)
VAR _result =
DIVIDE ( _MonthSales, _TotalSales )
RETURN
_result
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum