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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
delithyotho
Frequent Visitor

using Text.Proper in a condition

Hi Everyone,

 

Is there a workaround for this query:

 

Query M:

IF [Column1] = "sample1" THEN Text.Proper([Column2]) ELSE [Column2]

 

I am trying to Capitalize Each Word a column that is under a condition that all of them belongs to Column1 = sample1 only

 

My raw data looks like this:

 

Column1Column2
Sample1TEXT SAMPLE
Sample2Text Sample
Sample3T.E.X.T Sample

 

Thank you in advance! 😁

1 ACCEPTED SOLUTION
SamInogic
Solution Sage
Solution Sage

Power BI DAX did not allow Text.Proper() in the expressions, so we can use the below workaround for this requirement to convert the Text from Column 2 as Proper Case (i.e. First letter of each word will be Capital).

Create a column in table with below DAX expression:

FormattedText = IF('Sample Table'[Column1] = "Sample1",

var SplitChar = " "

var column2Data = 'Sample Table'[Column2]

VAR ConvertedDataTable =

    ADDCOLUMNS (

        GENERATE (        

            CALCULATETABLE( 'Sample Table', 'Sample Table'[Column2]  = column2Data ),

            VAR TokenCount =

                PATHLENGTH ( SUBSTITUTE ( 'Sample Table'[Column2] , SplitChar, "|" ) )

            RETURN

                GENERATESERIES ( 1, TokenCount )

        ),

        "Proper",

            var word = PATHITEM ( SUBSTITUTE ( 'Sample Table'[Column2] , SplitChar, "|" ), [Value] )  

            var word_Propper = UPPER( LEFT( word, 1 ) ) & LOWER( RIGHT( word, LEN( word) - 1 ) )

            return

                word_Propper

    )

RETURN

    CONCATENATEX( ConvertedDataTable, [Proper], " " ), 'Sample Table'[Column2])

 

Please refer to the below screenshot for the same,

 

SamInogic_0-1670904324184.jpeg

 

The Output will be as follows:

 

SamInogic_1-1670904324191.jpeg

If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.

 

Thanks!

Inogic Professional Services
An expert technical extension for your techno-functional business needs
Power Platform/Dynamics 365 CRM
Drop an email: crm@inogic.com
Service: http://www.inogic.com/services/
Power Platform/Dynamics 365 CRM Tips and Tricks: http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

View solution in original post

1 REPLY 1
SamInogic
Solution Sage
Solution Sage

Power BI DAX did not allow Text.Proper() in the expressions, so we can use the below workaround for this requirement to convert the Text from Column 2 as Proper Case (i.e. First letter of each word will be Capital).

Create a column in table with below DAX expression:

FormattedText = IF('Sample Table'[Column1] = "Sample1",

var SplitChar = " "

var column2Data = 'Sample Table'[Column2]

VAR ConvertedDataTable =

    ADDCOLUMNS (

        GENERATE (        

            CALCULATETABLE( 'Sample Table', 'Sample Table'[Column2]  = column2Data ),

            VAR TokenCount =

                PATHLENGTH ( SUBSTITUTE ( 'Sample Table'[Column2] , SplitChar, "|" ) )

            RETURN

                GENERATESERIES ( 1, TokenCount )

        ),

        "Proper",

            var word = PATHITEM ( SUBSTITUTE ( 'Sample Table'[Column2] , SplitChar, "|" ), [Value] )  

            var word_Propper = UPPER( LEFT( word, 1 ) ) & LOWER( RIGHT( word, LEN( word) - 1 ) )

            return

                word_Propper

    )

RETURN

    CONCATENATEX( ConvertedDataTable, [Proper], " " ), 'Sample Table'[Column2])

 

Please refer to the below screenshot for the same,

 

SamInogic_0-1670904324184.jpeg

 

The Output will be as follows:

 

SamInogic_1-1670904324191.jpeg

If this answer helps, please mark it as Accepted Solution so it would help others to find the solution.

 

Thanks!

Inogic Professional Services
An expert technical extension for your techno-functional business needs
Power Platform/Dynamics 365 CRM
Drop an email: crm@inogic.com
Service: http://www.inogic.com/services/
Power Platform/Dynamics 365 CRM Tips and Tricks: http://www.inogic.com/blog/

Inogic Professional Services: Power Platform/Dynamics 365 CRM
An expert technical extension for your techno-functional business needs
Service: https://www.inogic.com/services/
Tips and Tricks: https://www.inogic.com/blog/

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors