exam questions

Exam DA-100 All Questions

View all questions & answers for the DA-100 exam

Exam DA-100 topic 1 question 6 discussion

Actual exam question from Microsoft's DA-100
Question #: 6
Topic #: 1
[All DA-100 Questions]

HOTSPOT -
You have an API that returns more than 100 columns. The following is a sample of column names.
✑ client_notified_timestamp
✑ client_notified_source
✑ client_notified_sourceid
✑ client_notified_value
✑ client_responded_timestamp
✑ client_responded_source
✑ client_responded_sourceid
✑ client_responded_value
You plan to include only a subset of the returned columns.
You need to remove any columns that have a suffix of sourceid.
How should you complete the Power Query M code? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: Table.RemoveColumns -
When you do ג€Remove Columnsג€ Power Query uses the Table.RemoveColumns function

Box 2: List.Select -
Get a list of columns.

Box 3: Text.Contains -
Example code to remove columns with a slash (/):
let
Source = Excel.Workbook(File.Contents("C: Source"), null, true),
#"1_Sheet" = Source{[Item="1",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(#"1_Sheet", [PromoteAllScalars=true]),
// get columns which contains any slash among values
ColumnsToRemove =
List.Select(
// get a list of all columns
Table.ColumnNames(#"Promoted Headers"),
(columnName) =>
let
// get all values of a columns
ColumnValues = Table.Column(#"Promoted Headers", columnName),
// go through values and stop when you find the first occurence of a text containing a slash
// if there is a value with a slash, return true else false
ContainsSlash = List.AnyTrue(List.Transform(ColumnValues, each Text.Contains(_, "/"))) in

ContainsSlash -
),
// remove columns
Result = Table.RemoveColumns(#"Promoted Headers", ColumnsToRemove) in

Result -
Reference:
https://community.powerbi.com/t5/Power-Query/Remove-columns-containing-a-certain-value/td-p/759657

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
NS1992
Highly Voted 2 years, 11 months ago
Table.RemoveColumns List.Select Text.EndsWith
upvoted 25 times
...
[Removed]
Most Recent 2 years, 9 months ago
the last one is Text.EndsWith. the key point is these columns are only a sample. there may be some other columns that contain that suffix.
upvoted 2 times
...
claudeaboki
2 years, 10 months ago
what's strange is that I tested both and it works perfectly with the Text.Contains and TextEndsWith functions by removing the columns that have suffixes ending with Sourceid.
upvoted 1 times
claudeaboki
2 years, 10 months ago
I found the answer between the two functions. The function we should use here is TextEnsWith. I simply changed the names of the columns by including for example as a column name (client_sourceid, sourceid_test, api_source_id) and when I use the Text.Contains function it directly deletes all the columns where the word source_id is included in the name column while the question has a suffix ending with sourceid so the answer is clearly: Table.RemoveColumns , List.Select, TextEnsWith
upvoted 12 times
...
...
Mad0701
2 years, 11 months ago
Text.ends with returns TRUE if the text ends in the specified value or FALSE if the text ends in the specified value. answer is text.contains
upvoted 1 times
...
goldenfingaz
2 years, 11 months ago
The question specifically says "You need to remove any columns that have a suffix of sourceid." so the last one should be "Text.EndsWith"
upvoted 4 times
...
fumen
2 years, 11 months ago
Last one is end with or contain
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago