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
krishak77
Helper I
Helper I

Enter value in new column based on value from existing column

Hello All,

 

Can anyone help me with the below requirement with DAX formula?

 

the below values if we have on the column "user status" of cell it has to mention value as "Friction by design", "Frictionless" in new column and not only single value even with multiple value .

Below values are friction by design "GTIC GTKP GTKS GTMO GTNO GTNT GTOM GTPC GTPL GTSM GTRF C2AF C2BD C2BF CC1F CCAF CCAI CCDA CAPA"

Below values are Frictionless "TDDAT ATDD EDRP ZTAX DMFI"

Rest all the other values if we have on the column user status except above should be called as “Friction” If there are multiple values in same row below should be considered

“Friction by design” values with “Friction” value then it should be called as “Friction”

“Frictionless” values with “Friction” value then it should be called as “Friction”

“Friction by design” values with “Frictionless” value then it should be called as “Friction by design”

 

Below few samples

User StatusNew Column
GTPL C2AFFriction by design
GTIC TDDATFriction by design
TDDAT ATDDFrictionless
CCMT HDOMFriction
CCMT GTPL C2AFFriction
EDRPFrictionless
GTOMFriction by design

 

Thank you in advance

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

@lbendlin Thanks for your contribution on this thread.

Hi @krishak77 ,

I created a sample pbix file(see the attachment), please check if that is what you want.

1. Create a dimension table as below

vyiruanmsft_0-1711346892365.png

2. Create a calculated column as below in your fact table

Column = 
VAR design =
    CALCULATE (
        MAX ( 'Dimension'[Type] ),
        FILTER (
            'Dimension',
            SEARCH ( 'Dimension'[Status], 'Table'[User Status], 1, 0 ) > 0
                && 'Dimension'[Type] = "Friction by design"
        )
    )
VAR frictionless =
    CALCULATE (
        MAX ( 'Dimension'[Type] ),
        FILTER (
            'Dimension',
            SEARCH ( 'Dimension'[Status], 'Table'[User Status], 1, 0 ) > 0
                && 'Dimension'[Type] = "Frictionless"
        )
    )
VAR _other =
    CALCULATE (
        MAX ( 'Dimension'[Type] ),
        FILTER (
            'Dimension',
            SEARCH ( 'Dimension'[Status], 'Table'[User Status], 1, 0 ) > 0
        )
    )
VAR TextValue = [User Status]
VAR TextLength =
    LEN ( TextValue )
VAR TextNoSpaces =
    SUBSTITUTE ( TextValue, " ", "" )
VAR TextNoSpacesLength =
    LEN ( TextNoSpaces )
VAR SpaceCount = TextLength - TextNoSpacesLength
RETURN
    IF (
        NOT ( ISBLANK ( design ) ) && NOT ( ISBLANK ( frictionless ) ),
        "Friction by design",
        IF ( ISBLANK ( _other ), "Friction", _other )
    )

vyiruanmsft_1-1711347153701.png

If the above one can't help you figure out, please provide some sample data and expected result just as @lbendlin suggested. Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

@lbendlin Thanks for your contribution on this thread.

Hi @krishak77 ,

I created a sample pbix file(see the attachment), please check if that is what you want.

1. Create a dimension table as below

vyiruanmsft_0-1711346892365.png

2. Create a calculated column as below in your fact table

Column = 
VAR design =
    CALCULATE (
        MAX ( 'Dimension'[Type] ),
        FILTER (
            'Dimension',
            SEARCH ( 'Dimension'[Status], 'Table'[User Status], 1, 0 ) > 0
                && 'Dimension'[Type] = "Friction by design"
        )
    )
VAR frictionless =
    CALCULATE (
        MAX ( 'Dimension'[Type] ),
        FILTER (
            'Dimension',
            SEARCH ( 'Dimension'[Status], 'Table'[User Status], 1, 0 ) > 0
                && 'Dimension'[Type] = "Frictionless"
        )
    )
VAR _other =
    CALCULATE (
        MAX ( 'Dimension'[Type] ),
        FILTER (
            'Dimension',
            SEARCH ( 'Dimension'[Status], 'Table'[User Status], 1, 0 ) > 0
        )
    )
VAR TextValue = [User Status]
VAR TextLength =
    LEN ( TextValue )
VAR TextNoSpaces =
    SUBSTITUTE ( TextValue, " ", "" )
VAR TextNoSpacesLength =
    LEN ( TextNoSpaces )
VAR SpaceCount = TextLength - TextNoSpacesLength
RETURN
    IF (
        NOT ( ISBLANK ( design ) ) && NOT ( ISBLANK ( frictionless ) ),
        "Friction by design",
        IF ( ISBLANK ( _other ), "Friction", _other )
    )

vyiruanmsft_1-1711347153701.png

If the above one can't help you figure out, please provide some sample data and expected result just as @lbendlin suggested. Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lbendlin
Super User
Super User

Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?

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.