Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
katyaking10
New Member

Help assigning subsequent invoice numbers

Hello, I have identified the Last Invoice number used - SB.VIN24.000005. How do I assign a sebsequent Invoice number to each row? I need it to be SB.VIN24.000006, SB.VIN24.000007, SB.VIN24.000008 etc. Thank you!

Last No UsedDocument DateDocument TypeNo.
SB.VIN24.0000055/25/2024InvoiceSB.VIN24.000006
SB.VIN24.0000055/25/2024InvoiceSB.VIN24.000007
SB.VIN24.0000055/25/2024InvoiceSB.VIN24.000008
SB.VIN24.0000055/25/2024InvoiceSB.VIN24.000009
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @katyaking10 

If you want to add the sebsequent invoice number, you need to have a unique column to rank it, but on the sample data you have offered, you don't have the unqiue column, so it is better that, add an index column in power query first, select from 1, then apply it to power bi desktop.

vxinruzhumsft_0-1716514868177.png

Then create a calculated column, you can refer to the following code.

Final_No =
VAR a =
    INT (
        RIGHT (
            [Last No Used],
            LEN ( [Last No Used] ) - SEARCH ( ".", [Last No Used], 4 )
        )
    )
VAR b = a + [Index]
RETURN
    LEFT ( [Last No Used], LEN ( [Last No Used] ) - LEN ( b ) ) & b

Output

vxinruzhumsft_1-1716515453606.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @katyaking10 

If you want to add the sebsequent invoice number, you need to have a unique column to rank it, but on the sample data you have offered, you don't have the unqiue column, so it is better that, add an index column in power query first, select from 1, then apply it to power bi desktop.

vxinruzhumsft_0-1716514868177.png

Then create a calculated column, you can refer to the following code.

Final_No =
VAR a =
    INT (
        RIGHT (
            [Last No Used],
            LEN ( [Last No Used] ) - SEARCH ( ".", [Last No Used], 4 )
        )
    )
VAR b = a + [Index]
RETURN
    LEFT ( [Last No Used], LEN ( [Last No Used] ) - LEN ( b ) ) & b

Output

vxinruzhumsft_1-1716515453606.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors