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
PowerBI88
Helper III
Helper III

Split data field from Service Now

Hi,

from service now I get a date in the column task:latable_busienss_duration in the following format: "10 days 3 hous 10 minutes", I would like to split this column so that I will have a column with only days, a column with only hours and a column with only minutes.

here is a screenshot of the data: 

PowerBI88_0-1624263794570.png

 

 

Can you provide me some hint?

 

Thank you

Kind regards

Marta

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjSIT0msLI43js/ILy0qjgfyczPzSktSi5VidaKVTCCypqYoooYg0XhDsBawAFw3VJlSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Elapsed = _t]),
    #"Removed Plural" = Table.AddColumn(Source, "a", each Text.Remove([Elapsed], "s")),
    Mapping = Table.TransformColumns(#"Removed Plural", {"a", each let l = List.Zip(List.Split(Text.Split(_, "_"),2)) in Record.FromList(l{0}, l{1})}),
    #"Expanded Elapsed" = Table.ExpandRecordColumn(Mapping, "a", {"day", "hour", "minute"}, {"day", "hour", "minute"})
in
    #"Expanded Elapsed"

Screenshot 2021-06-21 110847.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
PowerBI88
Helper III
Helper III

thank you , it worked 🙂

CNENFRNL
Community Champion
Community Champion

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjSIT0msLI43js/ILy0qjgfyczPzSktSi5VidaKVTCCypqYoooYg0XhDsBawAFw3VJlSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Elapsed = _t]),
    #"Removed Plural" = Table.AddColumn(Source, "a", each Text.Remove([Elapsed], "s")),
    Mapping = Table.TransformColumns(#"Removed Plural", {"a", each let l = List.Zip(List.Split(Text.Split(_, "_"),2)) in Record.FromList(l{0}, l{1})}),
    #"Expanded Elapsed" = Table.ExpandRecordColumn(Mapping, "a", {"day", "hour", "minute"}, {"day", "hour", "minute"})
in
    #"Expanded Elapsed"

Screenshot 2021-06-21 110847.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

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.