How to count the number of times a month shows up minus 1?
Hi, I'm trying to create a logic into the line item "End". My goal is to count the number of times a specific month appears without including the first occurrence. If November appears 4 times, I would like the "end" line item to display 3. Similarly, if December appears 5 times, I want "end" to show as 4.
I want to use the END line item for my "MAX expense" calculation.
- module is dimensioned by weeks
Any ideas? thanks!
Best Answer
-
Please see below
No need for the extra Month dimension nor the max's nor the movingsum().
Hope this helps,
Rob
0
Answers
-
Try this:
Create a
Count
line item with the formula set to 1. Set the summary of this line item to Sum. Also create aMonth
line item with the formula ofPARENT(ITEM(Time))
In the
End
line item apply this formulaCount[LOOKUP: Month] - 1
Let me know if this works, not sure if I understood the question fully
0 -
If isfirstoccurrence is not supposed to be used then with the help of lookup and previous, it can be achieved.
Cheers!!
0 -
-
Hi, thanks! @anirudh @rob_marshall @HimanshuRaj
looks like I'm getting -1 instead of 3 for June, likely due to my model's use of the 13 - 4 week period.
My module operates on a weekly timescale, but the 'Month' line item is dimensioned by month, displaying periods instead of months. To address this, I've introduced a fake month list in the 'Month Mapping' line item.
My goal is to make the 'End Test' line item count the occurrences of a month under 'Month Mapping', excluding the first one. For instance, when June appears 4 times, I want the 'End Test' line item to display 3. I initially attempted manual entry in the 'End' line item, but because my module is dimensioned by SKUs, it's not practical to manually enter values for each SKU.
In short, I'm looking for a logic that tallies the occurrences of a month in the 'Month Mapping' line item while excluding the initial instance.[See attached: blueprint, time setting]
0