Forum Discussion
groups and binning
Hi Anonymous ,
Please share a part of sample data so that we can test and coding formula on it.
Notice: if you not have permission to upload sample file, please upload to onedrive or google drive and share link here.
Regards,
Xiaoxin Sheng
Hello Anonymous ,
I did mention the ultimate goal is to be able to group Dec 2017 and Jan 2018 as Jan 2018, Jan and Feb 2018 as Feb 2018 and so on.
| Grouping | Period |
| Jan-18 | Dec-17 |
| Jan-18 | Jan-18 |
| Feb-18 | Jan-18 |
| Feb-18 | Feb-18 |
| Mar-18 | Feb-18 |
| Mar-18 | Feb-18 |
Thank you & rgds,
Lina
- Anonymous7 years agoNot applicable
Here is a possible solution, I will just assume that you are calculating 2 months of sale:
You can start out with adding a date column:
Date = DATE( VALUE( RIGHT(Table2[Yr-Month];2) )+2000; SWITCH( LEFT(Table2[Yr-Month];3); "Jan";1;"Feb";2;"Mar";3;"Apr";4;"May";5;"Jun";6; "Jul";7;"Aug";8;"Sep";9;"Oct";10;"Nov";11;"Dec";12 ); 1 )And then you can group two months of data with a measure:
Sales2M = VAR currentMonthDate = IF(HASONEVALUE(Table2[Date]);VALUES(Table2[Date])) RETURN IF( NOT(ISBLANK(currentMonthDate)); [Total Sales] + CALCULATE([Total Sales];ALL(Table2[Yr-Month]);Table2[Date] = EDATE(currentMonthDate;-1)) )
Note that this function will only work when you filter on Period (in my case Yr-Month).Regards,
Kristjan76
- Anonymous7 years agoNot applicable
Hi Anonymous ,
Which condition you used to split one month to two part?
Regards,
Xiaoxin Sheng - Anonymous7 years agoNot applicable
HI Anonymous,
Sorry, I'm not sure if I understand your question?