Press "Enter" to skip to content

Curated SQL Posts

EXPAND() and COLLAPSE() in Power BI Visual Calculations

Marco Russo and Alberto Ferrari play the accordion:

In previous articles, we introduced the concepts of visual context, the visual lattice, and the two visual context navigation operations: EXPAND and COLLAPSE. In this article, we build on that knowledge to first compute a simple percentage over the parent: a simple calculation to consolidate the understanding of EXPAND and COLLAPSE. Next, we move on to a much more complex scenario, computing the inflation-adjusted sales using visual calculations.

Read on to see what the two functions do, using a pair of examples.

Comments closed

Common Table Expressions in Postgres

Ryan Booz builds a CTE:

In the first article in this transforming data series, I discussed how powerful PostgreSQL can be in ingesting and transforming data for analysis. Over the last few decades, this was traditionally done with a methodology called Extract-Transform-Load (ETL) which usually requires external tools. The goal of ETL is to do the transformation work outside of the database and only import the final form of data that is needed for further analysis and reporting.

However, as databases have improved and matured, there are more capabilities to do much of the raw data transformation inside of the database. In doing so, we flip the process just slightly so that we Extract-Load-Transform (ELT), focusing on getting the raw data into the database and transforming it internally. In many circumstances this can dramatically improve the iteration of development because we can use SQL rather than external tools.

Read on for the scenario and how you can use common table expressions in Postgres. They’re very similar to what we have in SQL Server, though a few differences do exist.

Comments closed

Cloud Governance Guidance in the Cloud Adoption Framework

Stephen Sumner notes an addition to the Microsoft Cloud Adoption Framework (CAF) for Azure:

We are thrilled to announce the latest enhancement to Microsoft’s Cloud Adoption Framework for Azure. We comprehensively updated our cloud governance guidance in the Govern section of the Cloud Adoption Framework (CAF). The updated governance guidance represents Microsoft’s commitment to supporting your organization’s cloud journey, offering a clearer, more accessible, and comprehensive path to effective cloud governance. It encompasses identity, cost, resource, data, and AI governance among other areas of governance categories.

Whether you’re a startup looking to scale efficiently or a large enterprise aiming to refine your governance practices, we designed this governance guidance to meet your needs and guide you to where you need to be.

Read on to learn more about what cloud governance means and the tooling available.

Comments closed

SQL Server Index Included Columns and Log Bloat

Forrest McDaniel explains that TANSTAAFL:

Let me share the conclusion now: included columns in an index always get included in the log record, even if they weren’t modified. The same is not true for the clustered index. This can really matter if log generation is important to your environment, e.g. using an AG.

Click through for the proof. We often think of included columns on indexes as being nearly free performance gains, but “nearly” is carrying a bit of water here. This shouldn’t dissuade you from using included columns on indexes, but is a valid reason not to include all 50 non-index columns in a table “just in case.”

Comments closed

Ensuring Data Label Visibility on Bar Charts

Erik Svensen figures out a way:

Power BI has 5 different ways of positioning data labels in a bar chart – Auto, Inside end, Outside end, Inside center and inside base.

Depending on the distribution of your data this can lead to labels are being hidden, cut off or positioned a way that looks strange for the user.

Read on for a clever solution to a weakness in Power BI’s formatting capabilities.

Comments closed

Microsoft Fabric Workspace Soft Deletion and Retention

Marc Lelijveld fills us in on the details:

This morning, I was looking for a specific tenant setting in the Fabric admin portal. While scrolling through a few of the tenant settings, I came across a specific one, which I like to elaborate on a bit more in detail, given I recently also had some questions around this topic from customers.

What happens if you delete a Fabric workspace? Is there a way to recover? How and for how long? Well, we now have a tenant setting to control this!

Click through for the details.

Comments closed

Comparing Direct Lake and Import Mode in Power BI

Marco Russo compares and contrasts:

What is the right choice between Direct Lake and Import mode in Power BI?

At SQLBI, we do not publish content until we have had enough time to experiment with and collect data about new features. We usually don’t break the news unless we have enough time to test a feature in preview and consider the released service solid enough. This did not happen with Direct Lake, and we have not published any Direct Lake content yet, but it seemed not urgent for reasons we will see soon. However, the feedback collected from many attendees of SqlBits 2024 and the first Microsoft Fabric Conference raised the alarm: too many people have an incorrect perception of Direct Lake, which should be addressed as soon as possible to avoid architectural mistakes and unnecessary additional implementation costs.

Click through for the tl;dr version, followed by the explanations.

Comments closed

Failover Groups in Azure SQL Database

Josephine Bush sets up a failover group in Azure SQL Database:

In today’s fast-paced digital world, keeping your data safe and accessible is more important than ever. That’s where Azure SQL Database steps in, offering a suite of tools to ensure your information is always within reach. Among these tools, failover groups shine, ready to jump into action whenever there’s a hiccup. So, let’s explore how failover groups in Azure SQL Database work their magic, ensuring your data stays safe and sound despite unexpected challenges.

Read on for the step-by-step instructions.

Comments closed

Accessibility Features in Power BI

Elena Drakulevska takes us through some of the accessibility features in Power BI:

As data professionals, we’re constantly striving to create reports that effectively communicate insights to our audience. Did you know that within Power BI, there are hidden accessibility features that can enhance the usability for all users—with minimal effort on your part? Today, we’re digging into this overlooked aspect of Power BI and exploring how these features can elevate your data visualization projects.

Click through for three features.

Comments closed