cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jochendecraene
Helper III
Helper III

Count cell that contain integers

Hi

 

I've got a colum that contains text and integers. I'd like to know home many unique codes (integers) there are in my dataset.

Can someone help me out? So I only want to count the cells with the integers in the example.

 

Knipsel.JPG

1 ACCEPTED SOLUTION

@jochendecraene 

Measure 3 = 
    VAR __Table = ADDCOLUMNS('Table4',"__IsNotInt",ISERROR(INT([Column1])))
RETURN
    COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER(__Table,[__IsNotInt]=FALSE()),"Int",[Column1])))

@ me in replies or I'll lose your thread!!!
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Learn Power BI 2nd Edition

View solution in original post

6 REPLIES 6
Greg_Deckler
Super User
Super User

@jochendecraene Maybe:

Measure 3 = 
    VAR __Table = ADDCOLUMNS('Table4',"__IsNotInt",ISERROR(INT([Column1])))
RETURN
    COUNTROWS(FILTER(__Table,[__IsNotInt]=FALSE()))

@ me in replies or I'll lose your thread!!!
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Learn Power BI 2nd Edition

@Greg_Deckler 

 

Thanks for the quick response.

This gives me the number of cells containing integers. But can I have a distinct count of the codes?

Measure 3 = 
    VAR __Table = ADDCOLUMNS('Table4',"__IsNotInt",ISERROR(INT([Column1])))
RETURN
    COUNTROWS(DISTINCT(FILTER(__Table,[__IsNotInt]=FALSE())))

@ me in replies or I'll lose your thread!!!
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Learn Power BI 2nd Edition

@Greg_Deckler 

 

that is giving me the same count as without the 'dsitcint' ...  I made a test column with 291 times the same code. The two measures return 291 as result. I've expected the new measure to return 1 ...

 

 

@jochendecraene 

Measure 3 = 
    VAR __Table = ADDCOLUMNS('Table4',"__IsNotInt",ISERROR(INT([Column1])))
RETURN
    COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER(__Table,[__IsNotInt]=FALSE()),"Int",[Column1])))

@ me in replies or I'll lose your thread!!!
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Learn Power BI 2nd Edition

@Greg_Deckler 

Thank you sir for your help. This workes 🙂

 

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors