Forum Discussion
CJ_96601
1 year agoHelper V
Measure
Support needed to create measure on how to show 6 months from previous year and 6 months from current year based on year selection
- Anonymous1 year ago
Hi CJ_96601
Based on your needs, I have created the following table.
Then you can use the following measure to get the result you want.Previous 6 months current year = VAR _Yearnum = YEAR(TODAY()) VAR _Monthnum = MONTH(TODAY()) VAR _total_sales = SUMX(FILTER(ALL('Table'),MONTH('Table'[Date]) > _Monthnum-6 && MONTH('Table'[Date]) <= _Monthnum && YEAR('Table'[Date]) = _Yearnum),'Table'[Sales]) RETURN _total_salesPrevious 6 months last year = VAR _Yearnum = YEAR(TODAY()) VAR _Monthnum = MONTH(TODAY()) VAR _total_sales = SUMX(FILTER(ALL('Table'),MONTH('Table'[Date]) > _Monthnum-6 && MONTH('Table'[Date]) <= _Monthnum && YEAR('Table'[Date]) = _Yearnum-1),'Table'[Sales]) RETURN _total_sales
Result:Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
1 year agoNot applicable
Hi CJ_96601
Based on your needs, I have created the following table.
Then you can use the following measure to get the result you want.
Previous 6 months current year =
VAR _Yearnum = YEAR(TODAY())
VAR _Monthnum = MONTH(TODAY())
VAR _total_sales = SUMX(FILTER(ALL('Table'),MONTH('Table'[Date]) > _Monthnum-6 && MONTH('Table'[Date]) <= _Monthnum && YEAR('Table'[Date]) = _Yearnum),'Table'[Sales])
RETURN _total_sales
Previous 6 months last year =
VAR _Yearnum = YEAR(TODAY())
VAR _Monthnum = MONTH(TODAY())
VAR _total_sales = SUMX(FILTER(ALL('Table'),MONTH('Table'[Date]) > _Monthnum-6 && MONTH('Table'[Date]) <= _Monthnum && YEAR('Table'[Date]) = _Yearnum-1),'Table'[Sales])
RETURN _total_sales
Result:
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.