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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Split delimiter-separated string into substrings and run DAX logic on each substring

(If this gets deleted again, can someone message me why? External links? Too many edits?)
I have a column of data containing 2 decimals per value:

 

SoftwareMajor.Minor.Build
Soft123.45.6780
Soft21.2.56441
Soft312.3.8210
Soft41.0.0000

 

Because there's 2 decimals per value, I can't run DAX logic on them as if they're numbers (which are limited to 1 decimal). So, I had the idea of separating each part of the 2-decimal values into substrings.

 

For example, 23.455.6780 would be separated into 3 substrings/variables:

Orig = "23.455.6780"

Major = "23"

Minor = "455"

Build = "6780"

 

Then, I'd like to make sure each of those numbers are high enough.

Psuedo code of a new column that returns "Good!" or "Bad" depending on if the software version number is in compliance:

 

SoftwareCompliance = 
    VAR Orig = SELECTEDVALUE('Software Packages'[Major.Minor.Build]) // Ex. "23.455.6780" <--The amount of numbers between each decimal can change
    VAR Major = "23" //I need to extract this from `Orig` programmatically
    VAR Minor = "455" //I need to extract this from `Orig` programmatically
    VAR Build = "6780" //I need to extract this from `Orig` programmatically
    RETURN SWITCH(
        TRUE(),
        VALUE(Major) >= 23
            && VALUE(Minor) >= 455
            && VALUE(Build) >= 6750, "Good!", // If the major, minor, and build #'s are all high enough, the software version is in-compliance.
        "Bad" // Otherwise, the software version is out-of-compliance.
    )

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Anonymous 

Download this sample PBIX file with the following example

This is really easy to do in Power Query - that's what it's built for 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCs5PKzFU0lEyMtYzMdUzM7cwUIrVgQgbAYUN9Yz0TM1MTAzhosYgUSM9Yz0LI0OEWhOwWgM9AyBQio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Software = _t, Major.Minor.Build = _t]),
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Major.Minor.Build", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Major.Minor.Build.1", "Major.Minor.Build.2", "Major.Minor.Build.3"}),
    #"Renamed Columns" = Table.RenameColumns(#"Split Column by Delimiter",{{"Major.Minor.Build.1", "Major"}, {"Major.Minor.Build.2", "Minor"}, {"Major.Minor.Build.3", "Build"}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Major", Int64.Type}, {"Minor", Int64.Type}, {"Build", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Software Compliance", each if [Major] >= 23 and [Minor] >= 455 and [Build] >= 6750 then "Good" else "Bad")
in
    #"Added Custom"

 

scom.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @Anonymous 

Download this sample PBIX file with the following example

This is really easy to do in Power Query - that's what it's built for 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCs5PKzFU0lEyMtYzMdUzM7cwUIrVgQgbAYUN9Yz0TM1MTAzhosYgUSM9Yz0LI0OEWhOwWgM9AyBQio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Software = _t, Major.Minor.Build = _t]),
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Major.Minor.Build", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Major.Minor.Build.1", "Major.Minor.Build.2", "Major.Minor.Build.3"}),
    #"Renamed Columns" = Table.RenameColumns(#"Split Column by Delimiter",{{"Major.Minor.Build.1", "Major"}, {"Major.Minor.Build.2", "Minor"}, {"Major.Minor.Build.3", "Build"}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Major", Int64.Type}, {"Minor", Int64.Type}, {"Build", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Software Compliance", each if [Major] >= 23 and [Minor] >= 455 and [Build] >= 6750 then "Good" else "Bad")
in
    #"Added Custom"

 

scom.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors