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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
k8lyn22
Regular Visitor

Help with summing only numbers and ignoring text values

I have 3 columns in a table that have both numeric values and text values.  I have written the same measure to sum only if the value is numeric, but I am getting an error for only one column.  It is trying to convert "NA" to number in one column (Cannot convert value 'NA' of type Text to type Number), but it is ignoring the same "NA" values in the other columns and successfully summing.  The only difference in the measure below is changing Column A to B and C. 

 

SUMX( FILTER( 'All Combined', ISNUMBER( IFERROR( VALUE( 'Table 1'[Column A] ), FALSE() ) ) = TRUE() ), VALUE( 'Table 1'[Column A] ) )

 

Table

Column AColumn BColumn C
12NA

6

NA87201
4762543NA
2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, you should replace the NA with null.  Thereafter, you can simply write this measure

Measure = sum('Table 1'[Column A])


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

v-xuxinyi-msft
Community Support
Community Support

Hi @k8lyn22 

 

I would like to apologize for the belated reply.

 

Have you solved your problem? If not, try the following:

 

Create several measures as follow

ASumOnlyNumbers = 
SUMX( 
    FILTER( 
        'Table', 
        ISNUMBER( 
            IFERROR( 
                VALUE( 'Table'[Column A] ), 
                BLANK() 
            ) 
        ) 
    ), 
    IFERROR( 
        VALUE( 'Table'[Column A] ), 
        BLANK() 
    ) 
)

 

BSumOnlyNumbers = 
SUMX( 
    FILTER( 
        'Table', 
        ISNUMBER( 
            IFERROR( 
                VALUE( 'Table'[Column B] ), 
                BLANK() 
            ) 
        ) 
    ), 
    IFERROR( 
        VALUE( 'Table'[Column B] ), 
        BLANK() 
    ) 
)

 

CSumOnlyNumbers = 
SUMX( 
    FILTER( 
        'Table', 
        ISNUMBER( 
            IFERROR( 
                VALUE( 'Table'[Column C] ), 
                BLANK() 
            ) 
        ) 
    ), 
    IFERROR( 
        VALUE( 'Table'[Column C] ), 
        BLANK() 
    ) 
)

 

vxuxinyimsft_0-1706596847707.png

Is this the result you expect?

 

Best Regards,
Community Support Team _Yuliax

 

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-xuxinyi-msft
Community Support
Community Support

Hi @k8lyn22 

 

I would like to apologize for the belated reply.

 

Have you solved your problem? If not, try the following:

 

Create several measures as follow

ASumOnlyNumbers = 
SUMX( 
    FILTER( 
        'Table', 
        ISNUMBER( 
            IFERROR( 
                VALUE( 'Table'[Column A] ), 
                BLANK() 
            ) 
        ) 
    ), 
    IFERROR( 
        VALUE( 'Table'[Column A] ), 
        BLANK() 
    ) 
)

 

BSumOnlyNumbers = 
SUMX( 
    FILTER( 
        'Table', 
        ISNUMBER( 
            IFERROR( 
                VALUE( 'Table'[Column B] ), 
                BLANK() 
            ) 
        ) 
    ), 
    IFERROR( 
        VALUE( 'Table'[Column B] ), 
        BLANK() 
    ) 
)

 

CSumOnlyNumbers = 
SUMX( 
    FILTER( 
        'Table', 
        ISNUMBER( 
            IFERROR( 
                VALUE( 'Table'[Column C] ), 
                BLANK() 
            ) 
        ) 
    ), 
    IFERROR( 
        VALUE( 'Table'[Column C] ), 
        BLANK() 
    ) 
)

 

vxuxinyimsft_0-1706596847707.png

Is this the result you expect?

 

Best Regards,
Community Support Team _Yuliax

 

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

Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, you should replace the NA with null.  Thereafter, you can simply write this measure

Measure = sum('Table 1'[Column A])


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.