The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi all,
I am new to Power BI and I am trying to get data to create a power BI report via a direct query to a Maria DB. I have two related tables that I would like to join and then import using a specialized SQL query. I could import both tables before joining but I don't feel the need to import all the data just to get rid of most of it. Here's an example simplified scenario. I have two tables posts and comments. I would like to load 1 table with the joined data, using the SQL below, rather than the two tables and then joining and processing them:
SELECT p.id, p.summary, p.view_count, IF(COUNT(c.id) > 0, 'Commented', 'Uncommented') AS status
FROM posts p
LEFT JOIN comments c
ON c.post_id = p.id
WHERE p.deleted_at IS NULL
GROUP BY p.id
I see there is a way to use an SQL query for for direct import for SQL server but I am using MariaDB. Is there a way to do this easily?
Hi @rbermanmw. Go to Power Query Editor ->New Source -> Get Data. In the source select MariaDB.
Enter the credentials
When you load the tables, you will see your SQL query in the formual section, modify that with your desired query and it should work.
@AbhinavJoshi Can you show me a screenshot of the formula section with an SQL query in it?
User | Count |
---|---|
69 | |
68 | |
66 | |
55 | |
28 |
User | Count |
---|---|
112 | |
82 | |
66 | |
48 | |
43 |