Press "Enter" to skip to content

Curated SQL Posts

Consider What You Count

Hans-Jürgen Schönig ran out of fingers:

The purpose of this post is not to share some fancy SQL techniques, some super cool magic AI tool that does whatever new hot thing or some crazy coding technique one can use in PostgreSQL. This is all about two simple things that are often forgotten or just neglected. We are of course talking about “awareness” and “clarity”.

Yes, it is that simple. If you don’t know what you have or if you don’t know what you want, all data is worthless (in a best case scenario) or even dangerous. 

The concept for discussion here is a simple count: how many customers do you have? But even fairly simple questions like this can cause difficulty in answering because of business complexities that we need to model in our databases. The problem is that the expedient answer may not be the correct one. This is also a key reason why we end up with debates in meetings about which value of revenue to use.

Leave a Comment

Finding the Top 10 Products each Year with DAX

Marco Russo and Alberto Ferrari build a top ten list:

We have written and updated a few pieces in the past about how to find the top products, such as Filtering the top products alongside the other products in Power BI and Filtering the Top 3 products for each category in Power BI.

Generally speaking, finding the top products requires using GENERATE and TOPN. However, there is an interesting variation of this scenario that solves a specific business problem. Once we have determined the top 10 products by year, we want to filter only those that appear in the top 10 in most years. Obtaining that list of products helps identify evergreen products, that is, the products that remain in the best-seller list consistently.

Click through for the demonstration.

Leave a Comment

An Error with Log Shipping in an Contained Availability Group

Rich Benner diagnoses an issue:

We’ve recently come up across a fun little bug with log shipping in contained availability groups. A cursory Google search did not bring up any useful posts for troubleshooting, so here we are. If you’re here for the bug, feel free to scroll to the bottom of this post. For the rest of you, however, let’s add a little context to this scenario before getting to the meat of the situation.

Click through for the issue, as well as how Rich was able to resolve the problem.

Leave a Comment

Generating an Entity Diagram in a Fabric Eventhouse

Guy Reginiano announces a new tool:

As your KQL database grows, tables gather data from several Eventstreams, functions connect different tables, update policies move and transform data, and materialized views quietly keep aggregated data up to date – all working together behind the scenes 

It’s powerful, but it can also be hard to see the full picture. 

That’s exactly why we built the Entity Diagram – to give you a simple, visual way to explore how everything in your database connects.

Click through to see how it works.

Leave a Comment

Building a Pyramid in R

Tomaz Kastrun has fun generating a triangle:

What motivates human behaviour can be captured in the Maslow’s hierarchy of needs (source: Wiki). Maslow and psychologists have articulated these needs in a form of a Pyramid, and ever since the concept had been widely adopted (also criticised), and yet, another adaptation is the Pyramid of R needs

Read on for Tomaz’s take, as well as how to generate such a pyramid.

Comments closed

“The Parameter is Incorrect” with Copy-DBACredential

Jack Corbett diagnoses a problem:

I was working with a client to do an upgrade/migration from SQL Server 2016 to SQL Server 2022, and this client assigns non-default ports to SQL Server.  As part of the process, I had to create a credential on one node and needed it on the other node, so I went to the handy Copy-DBACredential dbatools cmdlet, but it didn’t work.

Read on for the troubleshooting process and the ultimate issue.

Comments closed

Reviewing Power BI Report Interactions via Semantic Link Labs

Meagan Longoria wants to know about visual interactions:

It can be tedious to check what visual interactions have been configured in a Power BI report. If you have a lot of bookmarks, this becomes even more important. If you do this manually, you have to turn on Edit Interactions and select each visual to see what interactions it is emitting to the other visuals on the page.

But there is a better way!

Click through for that better way.

Comments closed