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
Syndicate_Admin
Administrator
Administrator

formula DAX

Good morning, I would like you to provide me with a formula to obtain the value to return, that is to say without in the column percentage continent the value% returns me the value before the % of the contario that returns me white.

percentageamount to be returned
30dwhite
15dwhite
5dwhite
15dwhite
15d2%2%
10d2%2%

Thank you.

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

Hi @Syndicate_Admin ,

You can create a calculated column as below:

amount to be returned = 
VAR _len =
    LEN ( 'Table'[percentage] )
VAR _pplace =
    IFERROR ( SEARCH ( "%", 'Table'[percentage], 1, 0 ), 0 )
VAR _dplace =
    IFERROR ( SEARCH ( "d", 'Table'[percentage], 1, 0 ), 0 )
RETURN
    IF (
        _pplace > 0,
        MID ( 'Table'[percentage], _dplace + 1, _pplace - _dplace ),
        "white"
    )

yingyinr_1-1623982598835.png

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

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

You can create a calculated column as below:

amount to be returned = 
VAR _len =
    LEN ( 'Table'[percentage] )
VAR _pplace =
    IFERROR ( SEARCH ( "%", 'Table'[percentage], 1, 0 ), 0 )
VAR _dplace =
    IFERROR ( SEARCH ( "d", 'Table'[percentage], 1, 0 ), 0 )
RETURN
    IF (
        _pplace > 0,
        MID ( 'Table'[percentage], _dplace + 1, _pplace - _dplace ),
        "white"
    )

yingyinr_1-1623982598835.png

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.

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.