Extract unit Of Measure:
Example
diesel(KL)
water(mineral+waste)(KL)
wood(Tons)
Need to extract units of Measure like
KL
KL
Tons
Note: in water need to extarct only KL
Let me know if any one knows the logic
Extract unit Of Measure:
Example
diesel(KL)
water(mineral+waste)(KL)
wood(Tons)
Need to extract units of Measure like
KL
KL
Tons
Note: in water need to extarct only KL
Let me know if any one knows the logic
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Brahma Prakash ShuklaRank #633 · 3.8K reputationPosted Dec 26, 2023, 5:07 AM EST
To extract the units of measure from your examples, you can use a combination of DAX functions like
LEFT,RIGHT,FIND, andLEN. Assuming your data is in a column named "Product" in a table, here's a DAX query that can help you achieve this:UnitOfMeasure = SWITCH( TRUE(), CONTAINSSTRING([Product], "(KL)"), "KL", CONTAINSSTRING([Product], "(Tons)"), "Tons", // Add more conditions as needed for other units of measure // If none of the conditions match, return an empty string BLANK() )This DAX query uses the
CONTAINSSTRINGfunction to check if the product description contains specific keywords like "(KL)" or "(Tons)". You can extend the conditions for other units of measure as needed.Please replace
[Product]with the actual column name in your table. If your data is in a different structure or format, you may need to adjust the logic accordingly.Amira BedhiafiRank #601 · 4K reputationPosted Jan 26, 2024, 1:32 PM EST
Try this :
ExtractUnitOfMeasure = VAR StartPos = SEARCH("(", [YourColumn], 1, LEN([YourColumn])) VAR EndPos = SEARCH(")", [YourColumn], StartPos, LEN([YourColumn])) VAR UnitOfMeasure = MID([YourColumn], StartPos + 1, EndPos - StartPos - 1) RETURN TRIM(UnitOfMeasure)