Forum Discussion
Average based on NMonth vs Month
- Anonymous2 years ago
Thanks for the reply from BeaBF . The following is my testing for your reference.
I added some data in the table.
Measure = VAR _Last1month = CALCULATE ( COUNT ( 'Table'[Company] ), FILTER ( 'Table', [Month_Year] >= MIN ( slicer[Month_Year] ) && [Month_Year] <= DATE ( YEAR ( MAX ( slicer[Month_Year] ) ), ( MONTH ( MAX ( slicer[Month_Year] ) ) - 1 ), DAY ( MAX ( slicer[Month_Year] ) ) ) ) ) VAR _lastmonth = CALCULATE ( COUNT ( 'Table'[Company] ), FILTER ( 'Table', [Month_Year] >= MIN ( slicer[Month_Year] ) && [Month_Year] <= MAX ( slicer[Month_Year] ) ) ) RETURN DIVIDE ( _Last1month, _lastmonth )Output:
Due to Security Policy, I am unable to open your link. If there is still a problem, please let me know the logic for calculating your desired result.
Best Regards,
Yulia XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello,
Can we take average based on company instead of sl no.
Regards,
Chandrashekar B
Thanks for the reply from BeaBF . The following is my testing for your reference.
I added some data in the table.
Measure =
VAR _Last1month =
CALCULATE (
COUNT ( 'Table'[Company] ),
FILTER (
'Table',
[Month_Year] >= MIN ( slicer[Month_Year] )
&& [Month_Year]
<= DATE ( YEAR ( MAX ( slicer[Month_Year] ) ), ( MONTH ( MAX ( slicer[Month_Year] ) ) - 1 ), DAY ( MAX ( slicer[Month_Year] ) ) )
)
)
VAR _lastmonth =
CALCULATE (
COUNT ( 'Table'[Company] ),
FILTER (
'Table',
[Month_Year] >= MIN ( slicer[Month_Year] )
&& [Month_Year] <= MAX ( slicer[Month_Year] )
)
)
RETURN
DIVIDE ( _Last1month, _lastmonth )
Output:
Due to Security Policy, I am unable to open your link. If there is still a problem, please let me know the logic for calculating your desired result.
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Chandrashekar2 years ago
Resolver III
Hello,
Thank you and will check.
Regards,
Chandrashekar B