Skip to content

DP-600 · Domain 4: Explore and analyze data · 22% of the exam

Task 4.2: Query data by using SQL

Querying a lakehouse and a warehouse with SQL or the visual query editor, and connecting to and querying semantic models through the XMLA endpoint.

Study it

Sample questions

Try each one before opening the answer. Every option is explained, with the Microsoft documentation page that proves it.

Question 1 · choose 1

An analyst runs a SELECT in the warehouse's SQL query editor that returns 85,000 rows, but the results grid shows only part of them. She needs all 85,000 rows in a spreadsheet on her laptop for a one-off reconciliation, without creating any objects in the warehouse. What should she do?

  1. AUse Open in Excel, which runs the selected T-SQL query in Excel
  2. BCopy the whole results grid and paste it into an Excel workbook
  3. CUse Save as table and then download the table
  4. DUse Save as view and open the view in the visual query editor
Show the answer and why
  • AUse Open in Excel, which runs the selected T-SQL query in Excel

    Correct

    Open in Excel downloads a workbook that executes the query, so Excel gets the full result rather than the preview.

  • BCopy the whole results grid and paste it into an Excel workbook

    Incorrect

    The grid preview holds only the first 10,000 rows, so the copy would be incomplete.

  • CUse Save as table and then download the table

    Incorrect

    Save as table creates a table in the warehouse, which she must not do.

  • DUse Save as view and open the view in the visual query editor

    Incorrect

    That creates a view, and the editor's preview would still show only part of the rows.

In the SQL query editor, the Results preview shows only the first 10,000 rows when a query returns more. Highlighting a SELECT statement gives actions such as Save as view, Save as table (a CREATE TABLE AS SELECT into a warehouse), Open in Excel and Visualize results. Open in Excel opens the corresponding T-SQL query in Excel and executes it, so the results can be worked with locally.

Question 2 · choose 1

In the SQL query editor, an analyst selects and runs a statement that fills a #recent session temp table, then selects and runs a second SELECT that joins #recent to dbo.Customers. The second run fails because #recent doesn't exist. What should she do?

  1. ACreate #recent with a global ## name so later runs can see it
  2. BRun both statements together in one execution of the query window
  3. CWrap the first statement in BEGIN TRANSACTION so the session stays open
  4. DGrant herself CREATE TABLE permission on the dbo schema
Show the answer and why
  • ACreate #recent with a global ## name so later runs can see it

    Incorrect

    Temp tables in the warehouse are session-scoped; a separate run still gets a new session.

  • BRun both statements together in one execution of the query window

    Correct

    Each Run is an independent batch with its own session, so the temp table exists only within the batch that created it.

  • CWrap the first statement in BEGIN TRANSACTION so the session stays open

    Incorrect

    Transaction control across separate runs is limited, because every Run is its own batch and session.

  • DGrant herself CREATE TABLE permission on the dbo schema

    Incorrect

    Permissions aren't the issue; the temp table was created, but in a session that ended.

In the SQL query editor, every time you run a query, it opens a separate session and closes it at the end of the execution, so session context isn't kept between independent runs. Each Run submits an independent batch request, and a session exists only per batch, which also limits transaction control statements across runs. Running the statements together keeps them in one session, where a session-scoped #temp table is visible.

Question 3 · choose 1

A business analyst who doesn't write SQL builds a query in the visual query editor of a lakehouse's SQL analytics endpoint by merging two tables and filtering rows, and wants other analysts to query the result by name, always over the tables' current rows, without a copy of the data. One of her steps shows a banner that says the query is not supported as a warehouse view because it can't be fully translated to SQL. What should she do?

  1. AUse Save as view anyway, because the untranslated step runs at query time in Power Query
  2. BRemove or replace the step that can't be translated to SQL, then use Save as view
  3. CUse Save as table in the SQL analytics endpoint
  4. DSwitch the query to a DDL statement in the visual editor
Show the answer and why
  • AUse Save as view anyway, because the untranslated step runs at query time in Power Query

    Incorrect

    A view is a SQL object, so steps that can't be translated to SQL can't be part of it.

  • BRemove or replace the step that can't be translated to SQL, then use Save as view

    Correct

    Save as view needs the visual query to translate fully to SQL; steps that don't fold block it.

  • CUse Save as table in the SQL analytics endpoint

    Incorrect

    The endpoint is read-only, and Save as table writes a copy of the results into a warehouse table with CREATE TABLE AS SELECT, which goes stale.

  • DSwitch the query to a DDL statement in the visual editor

    Incorrect

    The visual query editor runs only read-only SELECT statements; DDL and DML aren't supported.

The visual query editor uses Power Query diagram view, but only a subset of Power Query operations that support query folding is supported, and some steps make the banner say the query isn't supported as a warehouse view because it can't be fully translated to SQL. Save as view creates a view from a query that translates to SQL, and Save as table loads results into a warehouse table with CREATE TABLE AS SELECT. The editor runs only read-only SELECT statements.

Question 4 · choose 1

Analysts run ad hoc T-SQL against the SalesDW warehouse from SSMS all day, while ETL updates its tables from 01:00 to 04:00 and sometimes in short bursts during the day. Analysts must always query all tables as they were at 06:00 that day, keep one connection string, and see the 06:00 state of the next day without anyone copying data. What should you set up?

  1. AZero-copy clones of every table into a reporting schema, recreated each morning
  2. BA Direct Lake semantic model with automatic updates turned off, refreshed at 06:00
  3. CA warehouse snapshot of SalesDW whose timestamp a job rolls forward to 06:00 each day
  4. DA second warehouse loaded by a pipeline at 06:00 each day
Show the answer and why
  • AZero-copy clones of every table into a reporting schema, recreated each morning

    Incorrect

    Clones would have to be dropped and recreated per table, and analysts' queries would have to name the clone tables.

  • BA Direct Lake semantic model with automatic updates turned off, refreshed at 06:00

    Incorrect

    That controls a semantic model's data, but analysts query the warehouse with T-SQL from SSMS.

  • CA warehouse snapshot of SalesDW whose timestamp a job rolls forward to 06:00 each day

    Correct

    A snapshot is a read-only point-in-time view with its own connection, and rolling its timestamp forward is instant and atomic.

  • DA second warehouse loaded by a pipeline at 06:00 each day

    Incorrect

    Loading another warehouse copies the data, which the requirement rules out.

A warehouse snapshot is a read-only representation of a warehouse at a point in time. Its timestamp can be rolled forward on demand, with updates applied instantly as one atomic change, so consumers keep a consistent version of all tables through the same connection while ETL keeps changing the parent warehouse. Snapshots inherit their permissions from the source warehouse and require Import or DirectQuery for Power BI, not Direct Lake.

Question 5 · choose 1

An analyst with the Viewer role in the Sales workspace on an F64 capacity wants to run DAX queries against its semantic model from SQL Server Management Studio. The capacity's XMLA endpoint is read-only, and the tenant setting that allows XMLA endpoints is on. Her connection to powerbi://api.powerbi.com/v1.0/myorg/Sales succeeds, but she can't query the model. What does she need?

  1. AXMLA read-write enabled on the capacity
  2. BThe Contributor role in the Sales workspace
  3. CBuild permission on the semantic model
  4. DA Power BI Premium Per User license
Show the answer and why
  • AXMLA read-write enabled on the capacity

    Incorrect

    Read-only is enough for query operations in SSMS; read-write is for metadata changes.

  • BThe Contributor role in the Sales workspace

    Incorrect

    Contributor gives Write permission, far more than she needs; Build permission on the model is enough for queries.

  • CBuild permission on the semantic model

    Correct

    Build permission is required for read access through the XMLA endpoint, regardless of semantic model roles.

  • DA Power BI Premium Per User license

    Incorrect

    PPU licenses matter for PPU workspaces; this model is on an F64 capacity.

By default, the XMLA endpoint of a capacity's semantic models workload is read-only, which allows client tools such as SSMS to query semantic model data and metadata; read-write is needed for metadata operations. The tenant setting Allow XMLA endpoints and Analyze in Excel with on-premises semantic models must be on. Build permission on a semantic model is required for read access through the XMLA endpoint, regardless of the existence of model roles.

Question 6 · choose 2

Through the XMLA endpoint, you need DAX queries that return, first, the value of the [Total Sales] measure as a one-row result and, second, sales by month name sorted in calendar order. Month Name has a Sort by column set to Month Number in the model. Which two queries return what you need? (Choose TWO.)

  1. AEVALUATE { [Total Sales] }
  2. BEVALUATE [Total Sales]
  3. CEVALUATE SUMMARIZECOLUMNS('Date'[Month Name], "Sales", [Total Sales]) ORDER BY 'Date'[Month Name]
  4. DEVALUATE TOPN(12, SUMMARIZECOLUMNS('Date'[Month Name], "Sales", [Total Sales])) ORDER BY 'Date'[Month Name]
  5. EEVALUATE SUMMARIZECOLUMNS('Date'[Month Number], 'Date'[Month Name], "Sales", [Total Sales]) ORDER BY 'Date'[Month Number]
Show the answer and why
  • AEVALUATE { [Total Sales] }

    Correct

    Curly braces turn the scalar value into a one-row table, which EVALUATE can return.

  • BEVALUATE [Total Sales]

    Incorrect

    EVALUATE needs a table expression; a scalar has to be wrapped in a table constructor.

  • CEVALUATE SUMMARIZECOLUMNS('Date'[Month Name], "Sales", [Total Sales]) ORDER BY 'Date'[Month Name]

    Incorrect

    Sort by column doesn't apply to DAX query results, so this sorts alphabetically.

  • DEVALUATE TOPN(12, SUMMARIZECOLUMNS('Date'[Month Name], "Sales", [Total Sales])) ORDER BY 'Date'[Month Name]

    Incorrect

    TOPN doesn't use ORDER BY to pick rows, and Month Name still sorts alphabetically without its sort column.

  • EEVALUATE SUMMARIZECOLUMNS('Date'[Month Number], 'Date'[Month Name], "Sales", [Total Sales]) ORDER BY 'Date'[Month Number]

    Correct

    Including Month Number in the query lets ORDER BY sort in calendar order.

A DAX query requires EVALUATE followed by a table expression. A measure or other scalar expression can be returned as a table by enclosing it in curly braces, a table constructor such as EVALUATE {[Total Sales]}. The Sort by column property doesn't apply to DAX query results, so the sort column must be included in the query to be used in ORDER BY. TOPN has its own ordering; ORDER BY only sorts the result.

Question 7 · choose 1

A script connects to semantic models through the XMLA endpoint with powerbi://api.powerbi.com/v1.0/myorg/Contoso Sales. The tenant has two workspaces named Contoso Sales, and the connection fails because the name is ambiguous. Without renaming either workspace, how should the script identify the right one?

  1. AAppend the workspace ID to the workspace name in the URL
  2. BReplace myorg with the tenant's domain name
  3. CSwitch the connection string to the v2.0 format with /home/myworkspace
  4. DURL-encode the space in the workspace name as %20
Show the answer and why
  • AAppend the workspace ID to the workspace name in the URL

    Correct

    Duplicate workspace names are resolved by adding the workspace ID to the name in the URL.

  • BReplace myorg with the tenant's domain name

    Incorrect

    The tenant part identifies the tenant, not which of two workspaces with the same name to use.

  • CSwitch the connection string to the v2.0 format with /home/myworkspace

    Incorrect

    That v2.0 form addresses personal workspaces, not one of two shared workspaces.

  • DURL-encode the space in the workspace name as %20

    Incorrect

    Encoding special characters helps with names XMLA can't read, but both workspaces would still match.

The XMLA endpoint URL uses the format powerbi://api.powerbi.com/v1.0/[tenant name]/[workspace name], where myorg can stand for the tenant. When workspace names are duplicated, connect by appending the workspace ID to the name, for example Contoso Sales - followed by the GUID. The v2.0 format with home/myworkspace reaches personal workspaces, and special characters in workspace names can be URL-encoded.

Question 8 · choose 1

In the visual query editor of a warehouse, a query's SQL ends with an ORDER BY clause, and Visualize results doesn't work for it. Why?

  1. AVisualize results works only in the SQL query editor
  2. BThe query must first be saved as a view
  3. CVisualize results currently doesn't support queries with an ORDER BY clause
  4. DORDER BY isn't valid T-SQL in Fabric Data Warehouse
Show the answer and why
  • AVisualize results works only in the SQL query editor

    Incorrect

    Visualize results is available from the visual query editor too.

  • BThe query must first be saved as a view

    Incorrect

    Saving as a view isn't required to visualize results.

  • CVisualize results currently doesn't support queries with an ORDER BY clause

    Correct

    This is a listed limitation of the visual query editor.

  • DORDER BY isn't valid T-SQL in Fabric Data Warehouse

    Incorrect

    ORDER BY is valid; only this feature doesn't support it.

The visual query editor provides a no-code way to build queries with Power Query diagram view. One of its listed limitations is that Visualize Results currently doesn't support SQL queries with an ORDER BY clause; ORDER BY itself is valid T-SQL.

Question 9 · choose 1

A user with the Viewer role in a workspace builds a useful visual query on its warehouse and wants to move it to the Shared queries folder for the team. The option isn't available to her. Why?

  1. AVisual queries can't be saved at all
  2. BShared queries is available only for SQL queries, not visual queries
  3. COnly the warehouse owner can use Shared queries
  4. DViewers and shared recipients can save queries only in My queries
Show the answer and why
  • AVisual queries can't be saved at all

    Incorrect

    Visual queries are saved automatically every few seconds.

  • BShared queries is available only for SQL queries, not visual queries

    Incorrect

    The restriction depends on the user's role, not the query type.

  • COnly the warehouse owner can use Shared queries

    Incorrect

    Contributors and above can move queries there, not only the owner.

  • DViewers and shared recipients can save queries only in My queries

    Correct

    Users in the Viewer role or shared recipients of the warehouse can't move queries to Shared queries.

As you build a visual query, it's saved automatically every few seconds, and all workspace users can save their queries in the My queries folder. Users in the Viewer role of the workspace or shared recipients of the warehouse are restricted from moving queries to the Shared queries folder.

Question 10 · choose 1

You want a calculated table in a semantic model that lists every measure with its expression, so report authors can browse the model's documentation, and it should keep itself up to date. Which kind of DAX function can you use inside the calculated table?

  1. AINFO.VIEW functions, such as INFO.VIEW.MEASURES()
  2. BAny INFO function, such as INFO.MEASURES()
  3. CDMVs queried through the XMLA endpoint
  4. DThe SELECTEDMEASURENAME function
Show the answer and why
  • AINFO.VIEW functions, such as INFO.VIEW.MEASURES()

    Correct

    INFO.VIEW functions can run in calculated tables, columns, measures and DAX queries.

  • BAny INFO function, such as INFO.MEASURES()

    Incorrect

    Other INFO functions can only be run in DAX queries, not in calculated tables.

  • CDMVs queried through the XMLA endpoint

    Incorrect

    DMVs are queried by client tools, not used inside model calculations.

  • DThe SELECTEDMEASURENAME function

    Incorrect

    It returns the measure in context of a calculation item, not a list of measures.

INFO DAX functions return information about a semantic model, like DMVs, and require semantic model admin permissions. INFO.VIEW functions, the friendlier counterparts of four INFO functions, can be run in calculated tables, columns, measures and DAX queries, so a calculated table can self-document a model. The other INFO functions can only be run in DAX queries.

Question 11 · choose 1

An app must send DAX queries to semantic models through the Power BI REST API's Execute Queries operation, and every call is refused. Which tenant setting must be enabled?

  1. AAllow XMLA endpoints and Analyze in Excel with on-premises semantic models
  2. BSemantic Model Execute Queries REST API
  3. CUsers can work with semantic models in Excel using a live connection
  4. DAllow DirectQuery connections to Power BI semantic models
Show the answer and why
  • AAllow XMLA endpoints and Analyze in Excel with on-premises semantic models

    Incorrect

    That setting covers XMLA and Analyze in Excel connections, not the REST Execute Queries operation.

  • BSemantic Model Execute Queries REST API

    Correct

    This setting lets users in the organization query semantic models with DAX through the Power BI REST APIs.

  • CUsers can work with semantic models in Excel using a live connection

    Incorrect

    That setting covers exporting to Excel with a live connection.

  • DAllow DirectQuery connections to Power BI semantic models

    Incorrect

    That setting controls DirectQuery to semantic models in composite models.

The admin portal's integration settings include Semantic Model Execute Queries REST API, which lets users in the organization query semantic models by using DAX through the Power BI REST APIs. XMLA endpoint connections and Analyze in Excel are governed by other settings.

Practice domain 4 →Practice all domains →