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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Emansuhh
New Member

I have a question and can't find the solution

Hi all,

 

i work for a service organisation. we got a big list with orders numbers. they are logical build like: CS(support request) 23 (year) 01(month) 01(day) and than ticket nummer xxxx for example 0001.

so the compleet number is cs2301010001 i want to make a formule that see the logical sequence so i can sort on date and see all the ticket numbers and how many tickets i got each day.

thanks in advance,

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSi42MjYwBEIDA0Ol2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Order Number" = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Date", each #date(Number.From("20" & Text.Range([Order Number],2,2)),Number.From(Text.Range([Order Number],4,2)),Number.From(Text.Range([Order Number],4,2))), type date),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Ticket", each Text.End([Order Number],4),type text)
in
    #"Added Custom1"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSi42MjYwBEIDA0Ol2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Order Number" = _t]),
    #"Added Custom" = Table.AddColumn(Source, "Date", each #date(Number.From("20" & Text.Range([Order Number],2,2)),Number.From(Text.Range([Order Number],4,2)),Number.From(Text.Range([Order Number],4,2))), type date),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Ticket", each Text.End([Order Number],4),type text)
in
    #"Added Custom1"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.