cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
efebo
Frequent Visitor

How can I count numbers and text in a text column in SharePoint Online?

Hi,

 

Help, please.

 

I have this requirement:

 

I have a text column with text and number values, and I need to count separately each type. Based on the image, I will have:

countOnlyNumbers.png

 

Can I do that?

 

Additionally....

 

If I a change data type within Power BI, this will affect my data stored in SharePoint Online? E.g.: If I change my text column format to integer within Power BI.

 

Thanks in advanced.

1 ACCEPTED SOLUTION

@efebo 

Following @AlexisOlson 's answer, you can try this

Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table',NOT(ISERROR(VALUE('Table'[CONTENT])))&&NOT (ISBLANK('Table'[CONTENT]))))

1.PNG2.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

6 REPLIES 6
v-cazheng-msft
Community Support
Community Support

Hi @efebo 

Is your problem solved? 

 

Best Regards

Caiyun Zheng

v-cazheng-msft
Community Support
Community Support

Hi @efebo 

You can make some changes to your dax formula as the following.

 

var Num=COUNTROWS(FILTER('Table','Table'[values]<>""&&NOT(ISERROR(VALUE('Table'[values])))))

var Txt=COUNTROWS(FILTER('Table','Table'[values]<>""&&ISERROR(VALUE('Table'[values]))))

 

Best Regards

Caiyun Zheng

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

AlexisOlson
Memorable Member
Memorable Member

You could count the number of rows that can convert to a number without throwing an error.

 

VarNum =
COUNTROWS (
    FILTER ( Table1, NOT ISERROR ( VALUE ( Table1[RiesgoRegistrar] ) ) )
)

VarTxt = COUNTROWS ( Table1 ) - [VarNum]

 

Changing types in Power BI should not affect SharePoint at all. It should only be reading, not writing to SharePoint.

 

Hi @AlexisOlson 

 

It worked, thanks. However, I have an issue: empty cells (no data). I downloaded the data from SharePoint and I opened it in Excel. This is what I found:

 

250 items:
- 56 cells with text values in the "RegistroRegistrar" column.
- 120 cells with number values in the "RegistroRegistrar" column.
- 74 cells with no data (empt) in the "RegistroRegistrar" column.

 

VarTxt is 56 which is OK. Howerver, VarNum is 194 (I think that number is the result of 120 cells with number values + 74 cells with no data (empty)).

 

How can we excluse cell with no data (empty).

 

Thanks again.

@efebo 

Following @AlexisOlson 's answer, you can try this

Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table',NOT(ISERROR(VALUE('Table'[CONTENT])))&&NOT (ISBLANK('Table'[CONTENT]))))

1.PNG2.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

efebo
Frequent Visitor

Thanks @ryan_mayu.

It worked. 

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors