Your Microsoft Fabric Is a Mess Without DOMAINS!

Have you been using Domains? They are a great way to organize items within Microsoft Fabric and to allow delegation of tenant settings. Adam shows you what they are all about!

Fabric domains
https://learn.microsoft.com/fabric/governance/domains

Best practices for planning and creating domains in Microsoft Fabric
https://learn.microsoft.com/fabric/governance/domains-best-practices

📢 Become a member: https://guyinacu.be/membership

*******************

Want to take your Power BI skills to the next level? We have training courses available to help you with your journey.

🎓 Guy in a Cube courses: https://guyinacu.be/courses

*******************
LET’S CONNECT!
*******************

http://twitter.com/guyinacube
http://twitter.com/awsaxton
http://twitter.com/patrickdba
— <a href="http://www.facebook.com/guyinacube" Continue reading “Your Microsoft Fabric Is a Mess Without DOMAINS!”

OneLake Integration for Power BI Semantic Models

Want your Power BI Semantic Model data within OneLake? You may not have to rebuild anything. Patrick looks at how you can just integrate imported models directly into Microsoft Fabric OneLake!

OneLake integration for semantic models
https://learn.microsoft.com/power-bi/enterprise/onelake-integration-overview

📢 Become a member: https://guyinacu.be/membership

*******************

Want to take your Power BI skills to the next level? We have training courses available to help you with your journey.

🎓 Guy in a Cube courses: https://guyinacu.be/courses

*******************
LET’S CONNECT!
*******************

http://twitter.com/guyinacube
http://twitter.com/awsaxton
http://twitter.com/patrickdba
http://www.facebook.com/guyinacube
https://www.instagram.com/guyinacube/
— <a href="https://guyinacube.com" target="_blank" Continue reading “OneLake Integration for Power BI Semantic Models”

VBA With Power Query: Maximize Efficiency and Automate Your Data Processes in Excel (with VBA code)

What are the benefits of using VBA with Power Query?

Using VBA in conjunction with Power Query can provide significant benefits, especially when you need to automate complex workflows, integrate data from multiple sources, or perform advanced transformations programmatically. Here are the key benefits of using VBA over just using Power Query directly:

  1. Automation and Repetition:
    • Automation: VBA allows you to automate repetitive tasks, such as importing data from multiple files, applying the same transformations, and saving the results in a consistent format.
    • Scheduling: You can schedule VBA macros to run at specific times, ensuring data is updated automatically.
  2. Customization and Flexibility:
    • Custom Functions: VBA enables you to create custom functions and procedures that can be used within Power Query M code.
    • Dynamic Parameters: You can pass dynamic parameters to Power Query queries using VBA, allowing for more flexible data processing. This alone is a huge benefit!!
  3. Integration with Other Applications:
    • Interoperability: VBA can interact with other applications and services, such as databases, web APIs, and email clients, enhancing the capabilities of Power Query.
    • Data Export: You can use VBA to export data to various formats, such as PDF, CSV, or other Excel files, after it has been processed by Power Query.
  4. Complex Logic and Control:
    • Conditional Logic: VBA provides powerful conditional logic and control structures that can be used to handle complex data processing tasks.
    • Error Handling: You can implement robust error handling in VBA to manage unexpected issues during data processing.
  5. User Interface:
    • Custom UserForms: VBA allows you to create custom user interfaces (UserForms) for data entry and interaction, making it easier for users to perform complex tasks without needing to know Power Query M code.
    • Buttons and Macros: You can add buttons and macros to Excel worksheets to trigger VBA scripts, making it user-friendly.
  6. Advanced Data Manipulation:
    • Data Cleaning: VBA can be used for advanced data cleaning tasks, such as removing specific patterns, handling missing data, and normalizing data formats.
    • Data Transformation: VBA can perform complex transformations that might be difficult or impossible to achieve with Power Query alone.
  7. Version Control and Collaboration:
    • Version Control: VBA code can be version-controlled using tools like Git, allowing for better collaboration and tracking changes.
    • Shared Macros: You can share VBA macros with your team, ensuring consistency in data processing workflows. This can be especially helpful for vacation coverage or spreading the workload among multiple team members!
  8. Performance Optimization:
    • Efficiency: For large datasets, VBA can be more efficient in certain scenarios, especially when combined with Power Query for initial data loading and filtering.
    • Resource Management: VBA can manage system resources more effectively, ensuring smooth performance during data processing.

When to Use VBA Over Power Query

  • Complex Workflows: When you need to perform a series of complex transformations and data manipulations that are difficult to achieve with Power Query alone.
  • Integration with Other Systems: When you need to integrate Excel with other applications, databases, or web services.
  • Automated Reporting: When you need to automate the generation of reports and dashboards based on dynamic data sources.
  • Custom User Interfaces: When you need to create custom user interfaces for data entry and interaction.
  • Advanced Error Handling: When you need robust error handling and logging for data processing tasks.

When to Use Power Query Alone

  • Simple Data Transformation: When you need to perform simple data transformations and cleaning tasks.
  • Data Visualization: When you need to create dynamic data visualizations and dashboards.
  • Data Integration: When you need to integrate and combine data from multiple sources without complex logic.
  • Data Refresh: When you need to refresh data regularly from external sources.
  • Data Transformation: Power Query allows for complex data transformations, such as filtering, merging, and aggregating data.
  • Refreshable Data: Data imported using Power Query can be easily refreshed to update with new data.
  • Scalability: Power Query is better suited for larger datasets and more complex data processing tasks.

VBA with Power Query Code Samples with Explanations

Use Case: Importing Data from CSV Files Using Power Query

Power Query is a more advanced and flexible tool for data import and transformation in Excel. It allows for more complex data transformations and can handle larger datasets more efficiently. Here’s how you can use VBA to import a CSV file using VBA with Power Query.

End Sub

Explanation of Power Query VBA Code

  1. File Path and Connection Name:
    • filePath is the path to your CSV file
    • connName is the name of the Power Query connection.
  2. Delete Existing Connection:
    • The code checks if the connection already exists and deletes it to avoid conflicts.
  3. Create New Power Query Connection:
    • The Queries.Add method creates a new Power Query connection.
    • The Formula parameter specifies the Power Query M code to import and transform the CSV file.
  4. Load Query into Worksheet:
    • A new worksheet is created, and the query is loaded into it using LoadFromText

Use Case: Importing and Transforming Data from an Excel File Using Power Query and VBA

Objective: Import data from a specific worksheet in an Excel file, filter out rows with specific criteria, perform some transformations, and load the cleaned data into a new worksheet.

Preparation:

  1. Prepare the Source Excel File:
    • Ensure your source Excel file is located at a known path, e.g., C:\Data\source_data.xlsx.
    • Ensure the data is in a worksheet named SalesData.
  2. VBA Code to Import and Transform Data Using Power Query:

Explanation of the VBA Code

  1. Set File Path, Workbook Name, Sheet Name, and Names:
    • sourceFilePath is the path to your source Excel file.
    • sourceWorkbookName is the name of the source Excel file.
    • sourceSheetName is the name of the worksheet containing the data.
    • connName is the name of the initial Power Query connection.
    • queryName is the name of the transformed Power Query query.
  2. Delete Existing Connection and Query:
    • The code checks if the connection and query already exist and deletes them to avoid conflicts.
  3. Create a New Power Query Connection:
    • The Queries.Add method creates a new Power Query connection to import data from the specified worksheet in the Excel file.
    • The Formula parameter specifies the Power Query M code to import the data.
  4. Create a New Power Query Query for Transformation:
    • This query uses the initial connection as its source.
    • It skips the first row (assuming headers).
    • It removes duplicates based on specified columns.
    • It filters rows where Sales is greater than 100.
    • It sorts the filtered rows by Date in ascending order.
    • It adds a new column TotalSales calculated as Sales * Quantity.
  5. Load the Transformed Query into a New Worksheet:
    • A new worksheet is created, and the transformed query is loaded into it using LoadFromText.
  6. Format the Worksheet:
    • The code automatically fits the columns and applies a table style for better readability.

Detailed Steps

  1. Prepare the Source Excel File:
    • Update the path to match your source Excel file.
    • Ensure the data is in a worksheet named SalesData, or update that variable to match your data.
  2. Open VBA Editor:
    • Press Alt + F11 to open the VBA editor.
  3. Insert a New Module:
    • In the VBA editor, go to Insert > Module to create a new module.
  4. Copy and Paste the VBA Code:
    • Copy the above VBA code and paste it into the module.
  5. Run the Macro:
    • Close the VBA editor and return to Excel.
    • Press Alt + F8, select ImportAndTransformExcelDataWithPowerQuery, and click Run.
  6. View the Results:
    • A new worksheet named TransformedData will be created, showing the imported and transformed data.

Additional Tips

  • Customizing Columns:
    • You can customize the column names and the criteria for filtering and sorting based on your specific dataset.
  • Handling Different Workbooks and Sheets:
    • Adjust the sourceFilePath, sourceWorkbookName, and sourceSheetName variables to match your source file and worksheet.
  • Error Handling:
    • Add error handling to manage potential issues, such as file not found or invalid data.

Example: Combining VBA with Power Query for Automation of Reporting

Here’s a more detailed example that combines VBA with Power Query to automate a complex data processing workflow that can automate data reporting from start to finish, including transforming the data and outputting a user-friendly report.

Use Case: Automating Data Import, Transformation, and Reporting

Objective: Import data from multiple Excel files, perform transformations, and generate a consolidated report.

VBA Code:

Explanation of the VBA Code

  1. Set Folder Path and Names:
    • folderPath is the path to the folder containing the Excel files.
    • connName is the name of the initial Power Query connection.
    • queryName is the name of the transformed Power Query query.
  2. Delete Existing Connection and Query:
    • The code checks if the connection and query already exist and deletes them to avoid conflicts.
  3. Initialize a New Worksheet:
    • A new worksheet named ConsolidatedData is created to store the consolidated data.
  4. Loop Through Excel Files:
    • The code loops through all Excel files in the specified folder.
    • For each file, it creates a new Power Query connection to import data from the SalesData worksheet.
  5. Create a New Power Query Query for Transformation:
    • This query uses the initial connection as its source.
    • It skips the first row (assuming headers).
    • It removes duplicates based on specified columns.
    • It filters rows where Sales is greater than 100.
    • It sorts the filtered rows by Date in ascending order.
    • It adds a new column TotalSales calculated as Sales * Quantity.
  6. Load the Transformed Query into the Consolidated Worksheet:
    • The transformed data is loaded into the ConsolidatedData worksheet.
  7. Delete the Power Query Connection and Query:
    • After processing each file, the connection and query are deleted to clean up.
  8. Format the Worksheet:
    • The code automatically fits the columns and applies a table style for better readability.

Conclusion

Using VBA in conjunction with Power Query provides a powerful combination for automating and managing complex data workflows. While Power Query is excellent for data transformation and integration, VBA offers the flexibility and control needed for advanced automation and integration tasks. By combining these tools, you can create robust and efficient data processing solutions.

Feel free to comment other examples you would like to see as we continue to explore automation of workflows via both VBA and Power Query!

Hosting Your Own AI/Local LLM On Your PC (For Free)!

Hosting your own AI local LLM (Large Language Model) can offer several benefits, especially for individuals and organizations looking to leverage advanced AI capabilities while maintaining control and security. Here are some key advantages:

Control and Customization:

  • Tailored Solutions: Customize the model to fit specific business needs, industries, or datasets.
  • Data Privacy: Ensure that sensitive data remains within your control and is not shared with external providers.

Security:

  • Data Security: Protect sensitive information by hosting the model on-premises or in a secure cloud environment under your control.
  • Compliance: Meet regulatory and compliance requirements by having full control over data handling and model deployment.

Latency and Performance:

  • Reduced Latency: Host the model closer to where it is needed, reducing latency and improving response times.
  • Optimized Performance: Fine-tune the model and infrastructure for optimal performance tailored to your specific use case.

Cost Efficiency:

  • Long-term Savings: While initial setup costs can be high, hosting your own model can be more cost-effective in the long run, especially for large-scale deployments.
  • Avoid Vendor Lock-in: Reduce reliance on third-party services and potential vendor lock-in, giving you more flexibility in choosing solutions.

Scalability:

  • Flexible Scaling: Easily scale the model and infrastructure to meet changing demands without relying on third-party providers.
  • Resource Allocation: Allocate resources more efficiently based on your specific needs and budget.

Innovation and Research:

  • Advanced Research: Engage in cutting-edge research and development by leveraging the full capabilities of the model and infrastructure.
  • Experimentation: Conduct experiments and iterate on models without the constraints of third-party services.

Integration:

  • Seamless Integration: Integrate the model with existing systems and workflows more easily, ensuring a cohesive and efficient operation.
  • Custom APIs: Develop custom APIs and interfaces tailored to your specific requirements.

Resilience and Reliability:

  • Uptime: Ensure high availability and uptime by managing the infrastructure directly.
  • Disaster Recovery: Implement robust disaster recovery and backup strategies to protect against data loss and downtime.

By hosting your own LLM, you gain significant control over your AI infrastructure, enabling you to tailor solutions to your specific needs while maintaining security and performance. Read on as we walk through the process together.

Instructions (Windows)

  • Download Ollama. Head on over to ollama.com and download for Windows.
  • Install the application.
host your own local LLM - installation image for Ollama.
  • In the meantime, head over to the models page on the Ollama website and read through them to decide which you would like to install. Each model has a command to install it next to the tags. In the example below, it is ollama run llama3.3; copy this command.
  • Once Ollama is installed, start the application from the Start menu.
  • Open a command prompt (Windows logo key + R, type cmd and hit enter).
  • When the command prompt window opens, paste the command you copied from the model page and hit enter.
  • Close Ollama by typing /bye and hitting enter.
  • Next, download the appropriate version of Docker Desktop for your computer.
  • Go to the Open UI github here and scroll to the installation instructions.
  • Copy the “If Ollama is on your computer” command.
  • Run this command in the command prompt. The package is large and may take several minutes to download and install.
  • After the installation is complete, go to the Docker application and note the open-webui container.
  • In your browser, head to http://localhost:3000/
  • Note: On my machine, I had to stop and restart the Docker container the first time; if you are having an issue, try that first.
  • Select the model at the top.
  • You now have a lovely interface to interact with your model! The possibilities are endless.

Tracing your Power BI Report

Is your Power BI report taking too long? Are you curious about breaking down report rendering vs DAX query duration but don’t have Performance Analyzer from the service perspective? Adam shows you how you can trace your report in the service!

📢 Become a member: https://guyinacu.be/membership

*******************

Want to take your Power BI skills to the next level? We have training courses available to help you with your journey.

🎓 Guy in a Cube courses: https://guyinacu.be/courses

*******************
LET’S CONNECT!
*******************

http://twitter.com/guyinacube
http://twitter.com/awsaxton
http://twitter.com/patrickdba
http://www.facebook.com/guyinacube
https://www.instagram.com/guyinacube/
Continue reading “Tracing your Power BI Report”

MS 365 Excel Basics #5: IF Function & Logical Test. IFS, IFNA, OR, AND, NOT, ISNUMBER Functions More

Download Excel File: https://people.highline.edu/mgirvin/AllClasses/218M365/Content/ExcelBasics05.xlsx
Read (download right-click): pdf notes: https://people.highline.edu/mgirvin/AllClasses/218M365/Content/ExcelBasics05.pdf
In this video learn about logical tests which are the driver behind functions like IF, IFS, AND, OR, NOT, ISNUMBER and more. See 14 examples of logical tests and the IF function and more.
Topics:
1. (00:00) Introduction
2. (00:40) Topics in Video
3. (01:19) IF function and its arguments
4. (01:56) Logical tests in the Excel worksheet: Complete Story
5. (08:48) Logical formula using comparative operators, including a comparison to how comparative operators are used in functions like SUMIFS and COUNTIFS
6. (10:45) Logical formula using ISNUMBER function
7. (11:55) Logical formula using Continue reading “MS 365 Excel Basics #5: IF Function & Logical Test. IFS, IFNA, OR, AND, NOT, ISNUMBER Functions More”

Introducing Prompt Array – a new prompt; creation, library & collaboration tool

***** Video Details *****
Discover how to streamline your AI prompt management with PromptArray. In this video, you’ll see how to store, organize, and reuse prompts across multiple AI tools—from ChatGPT and Claude to emerging development platforms. Learn how to quickly create prompt groups, access community templates, and even chain prompts together for more complex workflows. PromptArray helps ensure you get high-quality results by crafting detailed, reusable prompts and keeping them all in one place. It’s a straightforward way to elevate your AI-driven projects and save time on repetitive tasks.

***** Related Links *****
https://www.promptarray.ai/

***** Learning with Enterprise DNA ***** Continue reading “Introducing Prompt Array – a new prompt; creation, library & collaboration tool”

Rebinding your Power BI Report with Semantic Link Labs

Maybe you are moving from Dev to Production, or you migrated your Power BI Semantic Models to Direct Lake. Now you need to repoint the reports to the new model. Patrick shows you how with Semantic Link Labs.

Semantic Link Labs
https://github.com/microsoft/semantic-link-labs

Use the Power BI Rebind API to move from cached to Azure AS
https://youtu.be/wjOLp4E5K4Q

Switch a Power BI Report’s dataset without needing Premium!
https://youtu.be/X_1tBbPwBMg

📢 Become a member: https://guyinacu.be/membership

*******************

Want to take your Power BI skills to the next level? We have training courses available to help you with your journey.

🎓 Guy in Continue reading “Rebinding your Power BI Report with Semantic Link Labs”

🔴 Microsoft Power BI / Fabric Q&A – LIVE (Dec 14, 2024) (Member Chat 2nd Half)

Join us live as we answer your questions about Power BI & Microsoft Fabric! Get your questions in the chat early as we don’t get to all of them.

💥 30 minutes: Open Q&A (Public)
💥 Then… Members Only Chat (Public can watch & Super Chat for Questions)

📢 RULES FOR Q&A: 📢

👉 Put a “Q:” in front of your comment to help us identify questions!
👉 Super chats take priority
👉 Do NOT re-post your questions! We’ll get to as many questions as we can.
👉 If you SPAM your question, you will be put in timeout

📢 Become a member: https://guyinacu.be/membership

*******************

Want Continue reading “🔴 Microsoft Power BI / Fabric Q&A – LIVE (Dec 14, 2024) (Member Chat 2nd Half)”

Excel – Unlock the Secrets of Excel’s New Compatibility Version! – Episode 2663

Microsoft Excel Tutorial: Unlock the Secrets of Excel’s New Compatibility Version!

Are you tired of mismatched results when sharing Excel files between coworkers using different versions? Microsoft has finally addressed this issue. Today we dive into the game-changing **Function Compatibility Version**.
This feature offers a solution to inconsistencies caused by updates to five key functions: **LEN, MID, SEARCH, FIND, and REPLACE**. While the updates might seem minor, the implications are massive, especially for teams juggling old and new versions of Excel.
Learn how the new **Compatibility Version** setting makes it easier to manage version disparities. Whether you’re stuck on Excel Continue reading “Excel – Unlock the Secrets of Excel’s New Compatibility Version! – Episode 2663”

Migrate your Power BI Semantic Models to Direct Lake

Want to make your Import or DirectQuery Power BI Semantic models use Direct Lake? Patrick highlights a way to do the migration and take full advantage of Microsoft Fabric!

Direct Lake Migration
https://www.elegantbi.com/post/direct-lake-migration

Michael Kovalsky
https://www.linkedin.com/in/michaelkovalsky/
https://www.elegantbi.com/

📢 Become a member: https://guyinacu.be/membership

*******************

Want to take your Power BI skills to the next level? We have training courses available to help you with your journey.

🎓 Guy in a Cube courses: https://guyinacu.be/courses

*******************
LET’S CONNECT!
*******************

http://twitter.com/guyinacube
http://twitter.com/awsaxton
http://twitter.com/patrickdba
http://www.facebook.com/guyinacube
https://www.instagram.com/guyinacube/
Continue reading “Migrate your Power BI Semantic Models to Direct Lake”

Leverage Copy Job to copy in the latest file in Data Factory

Copy Job within Data Factory can allow you to easily get your data into Microsoft Fabric with an easy-to-use UI. Also allowing you to quickly set up incremental load. Patrick shows you how!

What is the Copy job (preview) in Data Factory for Microsoft Fabric
https://learn.microsoft.com/fabric/data-factory/what-is-copy-job

📢 Become a member: https://guyinacu.be/membership

*******************

Want to take your Power BI skills to the next level? We have training courses available to help you with your journey.

🎓 Guy in a Cube courses: https://guyinacu.be/courses

*******************
LET’S CONNECT!
*******************

http://twitter.com/guyinacube
http://twitter.com/awsaxton
http://twitter.com/patrickdba
— <a href="http://www.facebook.com/guyinacube" Continue reading “Leverage Copy Job to copy in the latest file in Data Factory”