Creating a Ref number in BAQ query

Hi all,

Probably a simple one here, that I can’t wrap my head around… does anyone know of a simple expression I could use to create a Calculated field that creates a reference column similar to the below, please?

The BAQ query is pulling in open quotes, so the number of quotes in the query will be ever-changing so decided not to go down the case statement route.

Many thanks in advance :smiley:

row_number() over (partition by QuoteHed.QuoteNum)

2 Likes

Windowing function is the way to go, but that formula will start over every time your quote number changes. Not sure if that’s what you are looking for or not. The partition set what you want to each group of row numbers to be. If you want it for your whole query, I usually use something like Company that’s the same for all records.

Also, you’re going to need an orderBy on there. That’s required for row_number()

row_number() over (partition by QuoteHed.Company order By QuoteHed.QuoteNum)
4 Likes

This is exactly what we needed, thank you so much Brandon! :grin:

2 Likes