March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I have a dataset with item descriptions. Within those, there is information about volumes. How to extract just them?
Sample photo showing how the description works:
As you can see, volume data can be placed randomly within the descriptions. Also, it can be "L" for litres instead of "ml" but it's optional to include in the solution. It might be a calculated column written in Dax if there's no other option.
May I ask for your assistance?
Assuming the column name is Data, use below formula in a custom column
= List.Select(Text.Split([Data]," "),(x)=> try Value.Is(Number.From(Text.Split(Text.Replace(Text.Lower(x),"ml","l"),"l"){0}), type number) otherwise false and Text.Split(Text.Replace(Text.Lower(x),"ml","l"),"l"){1}=""){0}
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs5JTcwrTlVwS0xOVQhPLM5QMDIwyM1R8A9yVYrViVbySMxLUXAuSk3MVTAFioPFggPcjA0UfPJLMvPzwKIKugpu/kEKvv4uYPlksHIjM3MfhZLyUrCQhamBr48CWEIpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Data = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each List.Select(Text.Split([Data]," "),(x)=> try Value.Is(Number.From(Text.Split(Text.Replace(Text.Lower(x),"ml","l"),"l"){0}), type number) otherwise false and Text.Split(Text.Replace(Text.Lower(x),"ml","l"),"l"){1}=""){0}, type text)
in
#"Added Custom"
I'd recommend using List.First instead of {0} to avoid errors if the list is empty.
Here's a slightly simpler version:
List.First(
List.Select(
Text.Split([Data]," "), each
try Value.Is(Number.From(Text.Remove(Text.Lower(_), {"m","l"})), type number)
otherwise false
)
)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.