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
Bootkie2
Frequent Visitor

Place Numeric Records in a Table

Hello, I have a datasaet that has an answer column that will either contain a number or a text value. I am trying to create 2 lookup tables from master table so that rows with JUST numeric answers fall into 1 table and rows with non-numeric or alpha numeric values fall into another table like so. Is this possible?

Table Example.jpg

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

You should be able to do something like this:

 

Table 2 = 
VAR __table = ADDCOLUMNS(ALL('Table'),"__filter",IF(ISERROR([Answer]*1),BLANK(),[Answer]*1))
VAR __table1 = FILTER(__table,NOT(ISBLANK([__filter])))
RETURN
SELECTCOLUMNS(__table1,"QID",[QID],"Answer",[Answer],"RespondentID",[RespondentID])
Table 3 = 
VAR __table = ADDCOLUMNS(ALL('Table'),"__filter",IF(ISERROR([Answer]*1),[Answer],BLANK()))
VAR __table1 = FILTER(__table,NOT(ISBLANK([__filter])))
RETURN
SELECTCOLUMNS(__table1,"QID",[QID],"Answer",[Answer],"RespondentID",[RespondentID])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

To check numeric value refer

https://community.powerbi.com/t5/Desktop/Check-whether-characters-are-numeric/td-p/327628

 

Post that you can use summarize or other functions to separate the data.

Greg_Deckler
Super User
Super User

You should be able to do something like this:

 

Table 2 = 
VAR __table = ADDCOLUMNS(ALL('Table'),"__filter",IF(ISERROR([Answer]*1),BLANK(),[Answer]*1))
VAR __table1 = FILTER(__table,NOT(ISBLANK([__filter])))
RETURN
SELECTCOLUMNS(__table1,"QID",[QID],"Answer",[Answer],"RespondentID",[RespondentID])
Table 3 = 
VAR __table = ADDCOLUMNS(ALL('Table'),"__filter",IF(ISERROR([Answer]*1),[Answer],BLANK()))
VAR __table1 = FILTER(__table,NOT(ISBLANK([__filter])))
RETURN
SELECTCOLUMNS(__table1,"QID",[QID],"Answer",[Answer],"RespondentID",[RespondentID])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
jdbuchanan71
Super User
Super User

Hello @Bootkie2 

You can add a custome column in the query editor to check the answer type.

try if Int32.From ( [Answer] ) >= 0 and Int32.From ( [Answer] ) <= 9 then "number" else "text" otherwise "text"

AnswerType.jpg

Then from there you make two new queries, each that reference the original.  On that pulls just number answers and the other to pull just text and load those two queries into your model.

I have attached my sample file for you to look at.

Anonymous
Not applicable

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.