Bird
Raised Fist0
Power BIbi_tool~20 mins

SQL Server connection in Power BI - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
SQL Server Connection Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding SQL Server Connection Strings in Power BI

Which of the following connection strings correctly connects Power BI to a SQL Server instance named SQLPROD01 on the default port, using Windows Authentication?

AData Source=SQLPROD01;Initial Catalog=SalesDB;Integrated Security=False;
BServer=SQLPROD01,1433;Database=SalesDB;User Id=admin;Password=pass123;
CServer=SQLPROD01;Database=SalesDB;Integrated Security=False;User Id=admin;Password=pass123;
DServer=SQLPROD01;Database=SalesDB;Trusted_Connection=True;
Attempts:
2 left
💡 Hint

Windows Authentication uses Trusted_Connection=True or Integrated Security=True.

❓ dax_lod_result
intermediate
2:00remaining
DAX Measure for SQL Server Data Refresh Status

You have a table RefreshLog with columns RefreshDate and Status. You want a DAX measure that returns the count of successful refreshes in the last 7 days.

Which measure produces the correct result?

ASuccessfulRefreshes = COUNTROWS(FILTER(RefreshLog, RefreshLog[Status] = "Success" && RefreshLog[RefreshDate] <= TODAY() - 7))
BSuccessfulRefreshes = CALCULATE(COUNTROWS(RefreshLog), RefreshLog[Status] = "Success" && RefreshLog[RefreshDate] <= TODAY() + 7)
CSuccessfulRefreshes = CALCULATE(COUNTROWS(RefreshLog), FILTER(RefreshLog, RefreshLog[Status] = "Success" && RefreshLog[RefreshDate] >= TODAY() - 7))
DSuccessfulRefreshes = CALCULATE(COUNTROWS(RefreshLog), RefreshLog[Status] = "Success", RefreshLog[RefreshDate] >= TODAY() - 7)
Attempts:
2 left
💡 Hint

Use FILTER inside CALCULATE to apply multiple conditions correctly.

❓ visualization
advanced
2:00remaining
Best Visualization for SQL Server Query Performance Over Time

You have imported SQL Server query performance data with columns QueryName, ExecutionTime (in milliseconds), and ExecutionDate. You want to visualize trends of execution time for multiple queries over the last month.

Which visualization type is best suited for this purpose in Power BI?

ATable showing <code>QueryName</code> and average <code>ExecutionTime</code> for the last month
BLine Chart with <code>ExecutionDate</code> on X-axis and <code>ExecutionTime</code> on Y-axis, with separate lines for each <code>QueryName</code>
CPie Chart showing percentage of total execution time by query
DStacked Bar Chart showing total execution time per query for the last month
Attempts:
2 left
💡 Hint

To show trends over time for multiple categories, use a line chart with series.

🔧 Formula Fix
advanced
2:00remaining
Troubleshooting SQL Server Connection Timeout in Power BI

You try to connect Power BI to a remote SQL Server but get a timeout error. Which of the following is the most likely cause?

AThe SQL Server instance is not configured to allow remote connections.
BThe Power BI desktop version is outdated and incompatible with SQL Server.
CThe SQL Server database is empty with no tables.
DThe Power BI report has too many visuals causing slow rendering.
Attempts:
2 left
💡 Hint

Timeout errors usually relate to network or server settings.

❓ data_modeling
expert
3:00remaining
Optimizing Data Model for SQL Server DirectQuery in Power BI

You are using DirectQuery mode to connect Power BI to a large SQL Server database. To improve report performance, which modeling practice is best?

AUse star schema with fact and dimension tables, minimize calculated columns, and push calculations to SQL Server views.
BImport all tables fully and create many calculated columns in Power BI.
CCreate many-to-many relationships between all tables to increase flexibility.
DDisable query folding to ensure all transformations happen in Power BI.
Attempts:
2 left
💡 Hint

Good data modeling and pushing calculations to the source improves DirectQuery performance.

Practice

(1/5)
1. What is the main purpose of connecting Power BI to a SQL Server database?
easy
A. To import or query data directly for creating reports
B. To design the SQL Server database schema
C. To write SQL Server stored procedures
D. To backup the SQL Server database

Solution

  1. Step 1: Understand Power BI data sources

    Power BI connects to data sources like SQL Server to get data for reports.
  2. Step 2: Identify the purpose of connection

    The connection allows importing or querying data to visualize it in Power BI.
  3. Final Answer:

    To import or query data directly for creating reports -> Option A
  4. Quick Check:

    Power BI connection = data import/query [OK]
Hint: Power BI connects to get data, not to manage database [OK]
Common Mistakes:
  • Confusing Power BI with database design tools
  • Thinking connection is for database backup
  • Assuming Power BI writes SQL code
2. Which of the following is the correct way to specify the server name when connecting Power BI to SQL Server?
easy
A. ServerName/InstanceName
B. ServerName\InstanceName
C. ServerName-InstanceName
D. ServerName.InstanceName

Solution

  1. Step 1: Recall SQL Server instance naming

    SQL Server uses backslash \ to separate server and instance names.
  2. Step 2: Match correct syntax

    The correct format is ServerName\InstanceName, not with slashes or dots.
  3. Final Answer:

    ServerName\InstanceName -> Option B
  4. Quick Check:

    SQL Server instance separator = \ [OK]
Hint: Use backslash \ between server and instance [OK]
Common Mistakes:
  • Using forward slash or dot instead of backslash
  • Omitting instance name when required
  • Adding spaces around the backslash
3. You connect Power BI to SQL Server using DirectQuery mode. What happens when you refresh the report visuals?
medium
A. Power BI imports all data again from SQL Server
B. Power BI uses cached data and does not query SQL Server
C. Power BI queries the SQL Server live for updated data
D. Power BI disconnects from SQL Server after refresh

Solution

  1. Step 1: Understand DirectQuery mode

    DirectQuery mode means Power BI sends live queries to the database on demand.
  2. Step 2: Identify refresh behavior

    Refreshing visuals triggers live queries to SQL Server for current data.
  3. Final Answer:

    Power BI queries the SQL Server live for updated data -> Option C
  4. Quick Check:

    DirectQuery = live queries on refresh [OK]
Hint: DirectQuery means live data queries, not cached data [OK]
Common Mistakes:
  • Confusing DirectQuery with Import mode
  • Thinking refresh always imports all data
  • Assuming Power BI disconnects after refresh
4. You try to connect Power BI to SQL Server but get an error: "Cannot connect to server." What is the most likely cause?
medium
A. Incorrect server or database name entered
B. Power BI does not support SQL Server connections
C. Your computer is offline but server is reachable
D. You forgot to install Power BI Desktop

Solution

  1. Step 1: Check connection error meaning

    "Cannot connect to server" usually means wrong server or database info.
  2. Step 2: Rule out other causes

    Power BI supports SQL Server; offline computer means no connection; Power BI Desktop must be installed.
  3. Final Answer:

    Incorrect server or database name entered -> Option A
  4. Quick Check:

    Connection error = wrong server/database name [OK]
Hint: Double-check server and database names for typos [OK]
Common Mistakes:
  • Assuming Power BI lacks SQL Server support
  • Ignoring network or firewall issues
  • Not verifying Power BI installation
5. You want to create a Power BI report that always shows the latest sales data from SQL Server without importing all data each time. Which connection mode should you choose and why?
hard
A. DirectQuery, because it imports all data once
B. Import, because it loads all data once and never updates
C. Import, because it queries live data on demand
D. DirectQuery, because it queries live data on demand

Solution

  1. Step 1: Understand Import vs DirectQuery

    Import loads data once; DirectQuery queries live data each time.
  2. Step 2: Choose mode for latest data without full import

    DirectQuery fits because it fetches current data without importing all.
  3. Final Answer:

    DirectQuery, because it queries live data on demand -> Option D
  4. Quick Check:

    Latest data without import = DirectQuery [OK]
Hint: Use DirectQuery for live data, Import for snapshot [OK]
Common Mistakes:
  • Confusing Import with live querying
  • Choosing Import when data freshness is needed
  • Misunderstanding DirectQuery behavior
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard