Hello guys,
I have a document number with this format CS/UM/2022/11/001. I want the last 3 digits of this number to have to continue to the next series when the user adds new data. Let's say CS/UM/2022/11/002. Is it possible?
Thank you for your help.
I am using this formula for initial value:
"CS"&"/"&"UM"&"/"&YEAR([date])&"/"&MONTH([date])&"/"
Hi @alhazen
Basically anything is possible, but serial numbers should be avoided.
https://www.googlecloudcommunity.com/gc/Tips-Tricks/Serial-Numbers-If-You-Must/m-p/286300
For your question: you may need a column [number]
Your initial value expression would be:
"CS"&"/"&"UM"&"/"&YEAR([date])&"/"&MONTH([date])&"/" & (MAX(yourTable[Number])+1)
For reference:
Hello @Aurelien Thank you for responding.
I am using this formula MAX( LIST( 253 ) + claim[Serial] ) + 1.
Is it possible to reset LIST(253) to the LIST(001) when the years end?
@alhazen wrote:
Is it possible to reset LIST(253) to the LIST(001) when the years end?
Probably. It's up to you to define the mechanism for resetting it.
I would suggest to try this then:
"CS"&"/"&"UM"&"/"&YEAR([date])&"/"&MONTH([date])&"/" &
(
MAX(
SELECT(yourTable[Number],
YEAR(TODAY())=YEAR([date])
)
)+1
)
Does the number column need an initial value?
you can set 1. It's really up to you actually.
The formula you suggested doesn't work properly.
So I revised my formula to look like this:
"CS"&"/"&"UM"&"/"&YEAR([date])&"/"&MONTH([date])&"/" & [serial]
I put this formula in serial column an initial value
MAX(
SELECT(
claim[serial],
AND(
MONTH([date])=[_THISROW].[_month],
YEAR([date])=[_THISROW].[_year]
)
)
+
claim[serial])+1
But I am confused how to auto reset when today is new month. Let's say I have a collection of the current month's numbers:
Is that doable? Do you have any suggestions? @Steve
@alhazen wrote:
But I am confused how to auto reset when today is new month.
initial value for [serial] column:
IF(
ISBLANK(
SELECT(claim[serial],
AND(
MONTH([date])=[_THISROW].[_month],
YEAR([date])=[_THISROW].[_year],
[_ROWNUMBER]<>[_THISROW].[_ROWNUMBER]
))),
1,
MAX(
SELECT(claim[serial],
AND(
MONTH([date])=[_THISROW].[_month],
YEAR([date])=[_THISROW].[_year],
[_ROWNUMBER]<>[_THISROW].[_ROWNUMBER]
)))+1
)
Hey @Aurelien
Check out this for what I found
IF(
AND(
MONTH([date])=[_THISROW].[_month],
YEAR([date])=[_THISROW].[_year]),
MAX(
SELECT(
claim[serial],
AND(
MONTH([date])=[_THISROW].[_month],
YEAR([date])=[_THISROW].[_year]
),
)
)+1,
MAX(
SELECT(
claim[serial],
AND(
[_month]=[_THISROW].[_month],
[_year]=[_THISROW].[_year]),
)
)+1
)
Hi @alhazen
this:
IF(
AND(
MONTH([date])=[_THISROW].[_month],
YEAR([date])=[_THISROW].[_year]),
Does not really make sense, as it is equivalent to:
IF(
AND(
MONTH([date])=[_month],
YEAR([date])=[_year]),
Hence your expression (that I indented for reading purpose - I encourage you to do the same in the future) would be like:
IF(
AND(
MONTH([date])=[_month],
YEAR([date])=[_year]
),
MAX(
SELECT(claim[serial],
AND(
MONTH([date])=[_THISROW].[_month],
YEAR([date])=[_THISROW].[_year]
),
)
)+1,
MAX(
SELECT(claim[serial],
AND(
[_month]=[_THISROW].[_month],
[_year]=[_THISROW].[_year]
),
)
)+1
)
I assume [_month] and [_year] are virtual columns.
If these are MONTH([date]) and YEAR([date]), then you would want to reconsider this expression.
Hey @Aurelien Glad you are still responding to this discussion
It works properly as my expectations.
correct, [_month] and [year] are virtual columns
Let me check for you suggestions
User | Count |
---|---|
43 | |
26 | |
23 | |
16 | |
12 |