Speaking about Microsoft Fabric at AdaCon 2023

On Tuesday, October 10th, 2023, I will be speaking at AdaCon 2023 🥳

The amazing Patricia Aas started the Ada Lovelace Day mini-conference in 2019. Back then, there were a few large Women In Tech groups and events in Norway, but they mainly celebrated women in management and leadership positions in tech-focused companies. Patricia wanted to celebrate Women doing Tech, and created the mini-conference to give coders, developers, engineers and everyone else working hands-on with tech an arena to share their knowledge. This year, the event has been rebranded to AdaCon and expanded to celebrate all groups that are underrepresented in tech 👏🏻

I will be presenting a session called Website Analytics in My Pocket using Microsoft Fabric. This is a brand new session, and I’m super excited to finally be able to play around with Power BI! 🤓

Speaker card showing Cathrine Wilhelmsen and the other speakers at AdaCon 2023.

You can find the schedule and full agenda on the AdaCon website. This is going to be an important and inspiring day full of learning, so I hope to see you there! 💙

Microsoft Data Platform MVP 2023-2024

Cathrine Wilhelmsen holding a Microsoft MVP 2023 mug. On July 6th, I received my 9th MVP Award and became a Microsoft Data Platform MVP 2023-2024, yaaaaay! 🤓🥳

In previous years, being awarded as a Microsoft MVP was my biggest achievement of the entire year. This year, however, it’s my second biggest achievement. What could possibly beat that, you may ask? Oh, you know, just fighting and surviving another major depressive episode.

Earlier this year, all I could do was survive. Now? Now I’ve kicked my depression in its big ol’ rear-end as far away from me as possible. My creativity is returning and ideas are popping up every day. Life is finally worth living again. Receiving this MVP Award was just the (most delicious) icing on the cake 😊💙

I feel ready to get back into speaking again, and I already have a few events planned this year, yay! At work, I’m involved in several Microsoft Fabric projects and I finally get to play around with Power BI, yay! In my local community, the kickass ladies Marthe, Emilie, and Ioana are all inspiring me to get more involved again, yay! I’m finally excited about the things I love and it feels amazing 🥳

Oh, and look at this shiny badge I got:

Microsoft MVP 2023 badge.

I’m ready for another year as a Data Platform MVP. Thank you so much to all of you for all your support, and to Microsoft for seeing my value when I didn’t. Let’s gooo! 🤓

Participating in the Microsoft Fabric AMA (Ask Me Anything) hosted by MDPUG Norway

On Wednesday, June 21st, 2023, I will be participating in the Microsoft Fabric AMA (Ask Me Anything) hosted by Microsoft Data Platform User Group Norway.

Speaker card showing Cathrine Wilhelmsen and the other MVPs participating in the Microsoft Fabric AMA.

Microsoft Fabric was launched in public preview in May. It was called the greatest invention since SQL Server and promises to simplify analytics for everyone. Microsoft used Build, one of its flagship events, to launch Microsoft Fabric to much fanfare - and surrounded by lots of hype. But is the hype real?

Register for the event on Meetup 🤓

Microsoft Fabric AMA (Ask Me Anything) with ALL the Norwegian MVPs!

For the first time ever, all the Microsoft Data Platform MVPs from Norway will be on stage together. I’m so excited! 🤩 We have all kinds of backgrounds, experiences, perspectives and opinions, and this is your chance to ask all your difficult questions. Or all your basic questions, there are no “dumb” questions!

You’re also welcome to join us for a little summer gathering after the event. We’ll enjoy something cold to drink, chat, network, and have fun! Hope to see you there 🥳

Speaking at Data Platform WIT/DEI Mental Health and Wellness Day 2023

On Friday, May 5th, 2023, I will be speaking at the Data Platform WIT/DEI Mental Health and Wellness Day. This is a free, virtual, all-day event for anyone working in technology. Topics range from dealing with stress, burnout, depression or chronic pain, to working in tech as a queer or neurodiverse person.

I will be presenting a session called Stressed, Depressed, or Burned Out? The Warning Signs You Shouldn’t Ignore. This is a deeply personal session based on my own experiences from the past decade, and it’s one of the few sessions I can’t and don’t want to rehearse. It won’t be an hour of incoherent rambling (don’t worry! 😉) but it will be fairly raw and unfiltered.

Speaker card showing Cathrine Wilhelmsen presenting at Data Platform WIT/DEI Mental Health and Wellness Day 2023.

You can find the schedule and full agenda on the Data Platform Women in Tech website.

Solving FizzBuzz using SQL

Script icon.

This week, my coworkers and I were given a fun challenge. Using any tool or language, solve FizzBuzz! 🤓 Then present and explain the solution to the rest of the team. This was a fun challenge because our team is a mix of junior-to-senior developers and data professionals, working with everything from SQL to Python to C# to DAX to PowerShell. Those who had never solved FizzBuzz before got the chance to do so, while those who had already solved it got the chance to try again using a different tool or language.

While working on my solution, I ended up searching my own website for a post I wrote years ago: Using a Numbers Table in SQL Server. It gave me a nudge to share my FizzBuzz process and solution as well, even if there are a bazillion solutions already out there. I keep telling others to share what they do and learn, so this time I’m actually going to take my own advice. Go me! 😄

The FizzBuzz Challenge

FizzBuzz might be one of the most common programming challenges. The goal is to list all numbers from 1-100, but if a number is divisible by 3 you replace it with Fizz, if a number is divisible by 5 you replace it with Buzz, and if a number is divisible by both 3 and 5 you replace it with FizzBuzz:

  1. 1
  2. 2
  3. Fizz
  4. 4
  5. Buzz
  6. Fizz
  7. 7
  8. 8
  9. Fizz
  10. Buzz

…and so on.

Solving FizzBuzz in SQL

My first idea was to simply insert all values into a table and do a SELECT *, but I also wanted to actually solve the challenge 😂

Step 1: List all numbers from 1-100

I came up with three approaches using ROW_NUMBER() to list all numbers from 1-100.

My first approach was to query sys.all_objects:

SELECT TOP (100)
  ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS n
FROM sys.all_objects
ORDER BY n;

This felt a little too quick and dirty, though.

Next, I wanted to see if I could list the numbers without querying a table/view. At this point, I had the idea of a numbers table (or tally table) in my mind, since I have used and blogged about it in the past. I just couldn’t remember the syntax! 😅 So I boiled my logic down to “let’s just create 10 x 10 rows”. By using VALUES, I created two virtual tables with 10 rows (each containing the value 1), then cross joined the two tables:

SELECT
  ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS n
FROM (
  VALUES (1), (1), (1), (1), (1), (1), (1), (1), (1), (1)
) AS t1(n)
CROSS JOIN (
  VALUES (1), (1), (1), (1), (1), (1), (1), (1), (1), (1)
) AS t2(n)
ORDER BY n;

Finally, I looked up my numbers table syntax:

WITH
  L0   AS (SELECT 1 AS n UNION ALL SELECT 1),              -- 2 rows
  L1   AS (SELECT 1 AS n FROM L0 AS a CROSS JOIN L0 AS b), -- 4 rows (2 x 2)
  L2   AS (SELECT 1 AS n FROM L1 AS a CROSS JOIN L1 AS b), -- 16 rows (4 x 4)
  L3   AS (SELECT 1 AS n FROM L2 AS a CROSS JOIN L2 AS b), -- 256 rows (16 x 16)
  L4   AS (SELECT 1 AS n FROM L3 AS a CROSS JOIN L3 AS b), -- 65 536 rows (256 x 256)
  L5   AS (SELECT 1 AS n FROM L4 AS a CROSS JOIN L4 AS b), -- 4 294 967 296 rows (65 536 x 65 536)
  Nums AS (SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS n FROM L5)
SELECT TOP (100) 
  n 
FROM Nums 
ORDER BY n;

Step 2: Replace numbers with Fizz, Buzz, or FizzBuzz

Once I had figured out how to list the numbers, I needed to replace the numbers with Fizz, Buzz, and FizzBuzz. The challenge here, in any programming language, is to understand how to check whether a number is divisible by another number, and to understand in which order things are evaluated.

In SQL, you can use the % (modulus) operator to return the remainder after dividing one number by another. If the result is 0, it means that it is divisible.

(Fun fact: The first time I encountered the modulus operator, I thought that it returned the digit(s) after the decimal symbol. As in, I thought that 10 % 4 would return 5 because 10 / 4 = 2.5. Imagine my surprise when it returned 2! Why 2? And then I realized that ohhh, it’s because you can only fully fit the number 4 two times inside 10, and then you have 2 remaining… What can I say, math is difficult enough in my first language! 😅)

The final step is to construct the CASE expression so that it evaluates FizzBuzz first:

WITH
  L0   AS (SELECT 1 AS n UNION ALL SELECT 1),
  L1   AS (SELECT 1 AS n FROM L0 AS a CROSS JOIN L0 AS b),
  L2   AS (SELECT 1 AS n FROM L1 AS a CROSS JOIN L1 AS b),
  L3   AS (SELECT 1 AS n FROM L2 AS a CROSS JOIN L2 AS b),
  L4   AS (SELECT 1 AS n FROM L3 AS a CROSS JOIN L3 AS b),
  L5   AS (SELECT 1 AS n FROM L4 AS a CROSS JOIN L4 AS b),
  Nums AS (SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS n FROM L5)
SELECT TOP (100)
  CASE
    WHEN n % 3 = 0 AND n % 5 = 0 THEN 'FizzBuzz'
    WHEN n % 3 = 0 THEN 'Fizz'
    WHEN n % 5 = 0 THEN 'Buzz'
    ELSE CAST(n AS VARCHAR(3))
  END
FROM Nums
ORDER BY n;

Or, if you really just want that quick and dirty solution… 😁

SELECT TOP (100)
  CASE
    WHEN n % 15 = 0 THEN 'FizzBuzz'
    WHEN n % 3 = 0 THEN 'Fizz'
    WHEN n % 5 = 0 THEN 'Buzz'
    ELSE CAST(n AS VARCHAR(3))
  END
FROM (SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS n FROM sys.all_objects) AS t;

Your Turn!

How would you solve the FizzBuzz challenge? Can you think of a completely different approach? Can you fix my code and make it better or prettier? Go on, do it, it’s fun! 😃