Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Get started
Audit Transactions Before Power BI Import
00:00
5 left

Audit Transactions Before Power BI Import

MediumSQL · PostgreSQL

Problem

How do you connect to different data sources in Power BI, which connection type do you select, and what things must you check before importing via an SQL script?

Asked in the Technical Round stage. Initial technical questions focused on data ingestion and SQL preparation.

Write a PostgreSQL query that audits source transactions before they are imported into Power BI. Identify missing customer relationships, null required fields, non-positive amounts, and duplicate source references.

Output

  1. One row per source transaction, with transaction_id, customer_id, transaction_date, amount, import_status, and validation_issue.
  2. Mark rows as Ready only when all checks pass; otherwise mark them Review.
  3. Order by transaction_id ascending.

Output details

  • Treat source_reference as required, and report issues in this order: Missing customer, Missing transaction date, Missing amount or Non-positive amount, Missing source reference, Duplicate source reference.
  • Use NULL for validation_issue when no issues exist; otherwise separate multiple issue messages with ; exactly.
  • Flag Duplicate source reference only when a non-NULL source_reference occurs more than once, while retaining every source transaction.
  • Require an existing matching customer, non-NULL transaction_date, amount greater than 0, non-NULL source_reference, and no duplicate reference for Ready.

Schema

source_transactions
ColumnTypeDescription
transaction_idPKINTUnique source transaction identifier
customer_idINTCustomer associated with the transaction
transaction_dateDATEDate the transaction occurred
amountNUMERIC(12,2)Transaction amount
source_referenceVARCHAR(30)Reference supplied by the source system
source_customers
ColumnTypeDescription
customer_idPKINTUnique customer identifier
customer_nameVARCHAR(100)Customer display name
customer_statusVARCHAR(20)Current customer status
Tablessource_transactionssource_customers
Interviewer

Your question is Audit Transactions Before Power BI Import. Start with the requirements and the two tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.