Author Archives: sqlswimmer

Speaking at SQL Saturday Raleigh

I am happy to announce that I will be speaking at SQL Saturday Raleigh this Saturday, April 27, 2019.  I have been part of the organizing team for this event for the past few years so have never been able to speak (those of you who are fellow organizers know why!).  This year we had a last minute cancellation of an afternoon session, so I decided to step up and fill the slot.

I will be presenting my What is Power BI? session at 2:30pm.  If you’re in Raleigh with some time on your hands, stop by and say, “Hello”, I’d love to see you.  You can also check out some other great sessions as well, we still have registration slots available.

My Very First Azure SQL Database

I recently delivered my very first SQL Saturday pre-con for SQL Saturday Richmond on Friday, March 29, 2019.  You can read about that adventure here.

As part of the content for my pre-con, I wanted the attendees to be able to pull data from a database.  But how in the world was I going to make that happen?  I needed a database that would be accessible from the internet, but I didn’t have access to a server with this kind of access.

The light bulb went on and I thought, “What about an Azure SQL Database?”  Could I really do that?  I’ve been stuck in the on-premises world with no experience in Azure.  Would I even be able to get it stood up in time?  I mean really, I had less than a week to make it happen.  Surely that wouldn’t be enough time.

That’s the beauty of Azure SQL Database, it’s take almost no time to spin up a database and make it accessible via the internet.  In fact, it took me less than 5 minutes.

Once I had the database created in Azure I piped the data in via SSMS using the import data task, just like it was an on-premises server, whoa, how cool is that?!

So next time you need to stand up a database super quick, give Azure SQL Database a try.  It’s secure by default and you can control who has access to it very easily via the Azure Resource Manager.  Go ahead, give it a try.

Delivering My First Pre-Con

I didn’t announce this before it happened because I didn’t want to “jinx” myself, but I am happy to say that it’s finally happened.  I have delivered my very first SQL Saturday pre-con.  WooHoo!

It’s a session that I’ve been working on for a few months now.  The title is, From Zero to Dashboard Hero, and it’s aim is to get folks started with Power BI.  One of the great things about Power BI is that it’s so easy to use.  However, it also has a downside, it’s so easy to use.  The proverbial double edge sword.  This is the same thing that I saw happening with SQL Server back in the nineties.  It was so easy to use out of the box that businesses were standing up all kinds of instances and shoving data in as fast as they could, without regard for underlying architecture/hardware or good database design.  Those folks got themselves into some very deep holes that some very expensive consultants eventually had to get them out of.  I’m seeing the same trend with Power BI and I wanted to educate users before they found themselves at the bottom of a very big hole.

I started doing research on what training was available.  I found Microsoft’s Dashboard in a Day course that is offered for free and decided I needed to attend to see how Microsoft was “educating” people.  What I found was, disappointing.  It was mostly marketing material and the “lab” was basically turning attendees loose with an eighty plus page manual with little to no background in design.  Don’t get me wrong, it you know nothing about Power BI and want a free class, this is a viable option.  I just think users should have more.  What’s the saying, “Give a man a fish, he eats for a day.  Teach a man to fish and he eats for a life time.”

I had a basic idea of what I wanted to teach and how I wanted to teach it, but I had never put an ALL DAY session together before.  I’d created content for several 45-75 minute sessions, but never a session for 300+ minutes – EEK!  As it turns out, it wasn’t as daunting as I thought it would be thanks to some very good friends.

One of those friends is Michael Johnson (Blog | Twitter).  He was kind enough to let me “steal” ideas from his very similar session that he delivered at SQLBits this year.  He had some things in his session that I never would have thought about including in my content.  He also approached some topics very differently than I was thinking about.  Another friend that helped spur some ideas is Ginger Grant (Blog | Twitter).  Only a couple of weeks before I delivered my pre-con I was chatting with her about my content and she was asking all kinds of questions about my content that really got me thinking.  Thanks to her questions, I reworked some of my content to what I think made it more understandable.

The last friend that helped me out with this was Wayne Sheffield (Blog | Twitter).  Now, I first met Wayne in 2013 at SQL Saturday DC.  I was late arriving at the volunteer/speaker dinner (I was volunteering, NOT speaking!).  I was drenched from head to toe (I had taken the Metro from my hotel and had to walk the last few blocks in the rain), freezing and very hungry.  Most of the speakers had already finished their dinner, but Wayne was kind enough to alert the wait staff to my dilemma.  They brought towels out for me to dry myself, a fresh salad and a warm dinner.  Then I had a great conversation with Wayne.  I can’t remember exactly what we talked about, but I do remember his kindness.

Because of his kindness, when I first considered speaking at a SQL Saturday, I knew it had to be SQL Saturday Richmond.  I submitted my very first session there and was accepted back in 2017.  I think it only fitting that since he was the one who gave me my first break as a speaker for SQL Saturday three years ago, that he be the one to give me my first break with a pre-con.  I submitted my pre-con details and a few weeks later I found out my session had been selected.  I nearly fell out of my chair when I found out.  I then proceeded to panic, but I digress.

It’s been an amazing journey to get to this point in my career and I certainly couldn’t have done it without the help and support of my #SQLFamily.

My pre-con went off without a hitch, other than losing my voice towards the end of the day (thanks to allergy season being in full swing), I got great feedback from the attendees and I can’t wait to do it again!

 

Using Power BI To Track My Activities

As a MS MVP one of the things you have to do is keep track of all the “things” you do for community, whether it be volunteering, organizing, speaking, etc.  It can be a bit daunting trying to keep track of all of it.  But hey, I’m a Data Platform MVP, how hard can it be to keep track of data?!  Queue music from one of my favorite Blake Edwards movie .. Pink Panther.

At first I was just keeping track of everything in a text file via Notepad.  That got very unmanageable very quickly with all the different kinds of things I was doing.  I migrated all my data to a spreadsheet, because we all know that Excel is the most popular database in the world, right?

I knew that I had been busy in 2018, but I had no idea until I used Power BI to look at my data.  Yes, I was significantly busier in 2018 than I ever had been and 2019 is shaping up to be just the same if not busier.

Take a look at what I created.  It was a fun project to work on and allowed me to explore some things in Power BI that I don’t work with on a regular basis.  Let me know what you think.

Speaking at SQL Saturday Chicago

I am so excited and honored to announce that I have been selected to speak at SQL Saturday Chicago on Saturday, March 23, 2019.  I will be presenting my Profiling Your Data session.

It’s been a few years since I’ve been to Chicago.  Last time I was there was when I was working onsite for a client in Michigan in 2001.  My sister and her son came to visit me over a long weekend and we decided to road trip it to Chicago.  Neither of them had ever been before, so I gave them the grand tour, we road the subway, took in the Navy Pier and even got to see a White Sox game.  To this day, my sister still laughs nervously about her first subway ride.

If you’re in the area stop by and say, “hello”.  I’d love to see you and chat a bit.

Speaking at SQL Saturday Victoria

I am so excited to announce that I have been selected to speak at SQL Saturday Victoria on Saturday, March 16, 2019. I will be presenting my What is Power BI session.

This is another kind of homecoming for me.  When I was a kid, my sister & I lived with my grandparents for a while down in the Willamette Valley and we used to go to Victoria every summer.  I have very fond memories of Butchart Gardens and walking around The Land of the Little People.  I was super bummed when I found out that the latter no longer existed.  But if you have time, I would highly recommend Butchart Gardens and yes, they are open in Winter.

If you’re in the area, stop by and say, “hello”.  I’d love to see you and chat a while.

How To Use Power BI Embedded For Your Customers

Recently I had a need to build a Power BI report for a client.  This client has a multi-tenant database and their own custom web app.  They want to show each client their data without showing any other clients’ data. They also don’t want to require their customers have a Power BI license.  Easy enough, just use Power BI Embedded with the App Owns Data model and set up Roles (row-level security) in the Power BI Desktop file, should take less than five minutes to set up.  Well, we all know it took longer than five minutes or this blog post wouldn’t exist.

There are some great tutorials from Microsoft out there, they even provide a sample app on Github that you can download if you are not a web developer (I am so NOT a web developer!) to help you get started.  There are some great blog posts about it too, one from Reza Rad and one from Kasper de Jonge.  So why I am writing yet another blog post about it?  Because the devil is in the details, and I completely missed the details which means someone else must have as well.

I don’t want to repeat what others have already written, so go ahead, go read their posts, it’s okay I’ll wait here.

Now that you familiar with Row Level Security in Power BI, how do you make it work when you want to pass in your customer’s identifier because your customers don’t have Power BI accounts?  It seems like the only way to make dynamic row level security is to use the Username() DAX function?  But wait, doesn’t that require the user to have a Power BI account?  Sigh, it seems we are going in circles.

The one thing these articles don’t talk about is that when you are using Power BI Embedded, you can pass in whatever you like for the EffectiveIdentity via the Power BI API and it will “overwrite” the Username() function.  What?!  That’s right, it will completely ignore the Username() function and use whatever you give it.  WooHoo!

Let’s see an example, so it’s crystal clear.  I have a small sample of data that has some sales.

Embedded-Sample-Relationships

Let’s say I want to limit the view of the data by Region.  Here are my available regions.

Embedded-Sample-Regions

I would need to create a role based on Region that looks like this

Embedded-Sample-ManageRoles

Notice that I am using the Username() Dax function for Region.  I know, I know, my customers aren’t Power BI users, so this makes no sense, why would I use this?  Like I said earlier, the value that you pass via the Web API as the EffectiveIdentity will overwrite the Username() function.

Now that I have my Roles set in my Power BI Desktop file, I can publish my file to the Power BI service.  All that’s left to do is to add members to my role.  Now when using Power BI Embedded in this scenario, you only need to add one account to the role that was just created.  Just keep in mind that this account must be have a Power BI Pro license.

Navigate to the Security for the dataset.

Embedded-Sample-Navigate-to-Security

Add your user to the role

Embedded-Sample-Add-Account-To-Role

It should look like this now

Embedded-Sample-Final-Role

Now, let’s look at the sample web app and how this will work.  In the homecontroller.cs there is a call to EmbedReport which contains the creation of the EffectiveIdentity, this is where the magic happens.

Embedded-Sample-Effective-Identity

Let’s take a look at how this works from the front end.  Here’s my report with no security.

Embedded-Sample-No-Security

Now I just click the checkbox View as a different user, enter my values then click Reload.

Embedded-Sample-Filtered-Result

Presto change-o, the data is filtered for just the Midwest Region.  But wait, Midwest isn’t a Power BI user, so how does that work?  Again, the EffectiveIdentity overwrites the Username() function and applies whatever you have entered.  It’s magic, I’m telling you.

One thing that tripped me up was that I wanted to filter by RegionID, not region name.  When we work with data, we want to be as precise as possible so we typically use a primary key (or other unique identifier) to filter our data.  However I have discovered through trial and error that you cannot pass a number, you have to pass character data in order for the filter to work.  This means for your data you may need to ensure that there is some unique character data field to identify your customers other than a numeric ID field.

Oh, and if you want to play around with this you can use the sample app from Github and this Power BI Desktop file.

I hope this was helpful.

Update: 2-Feb-2019

I was asked an interesting question via Twitter by Dave Ruijter about converting data to string so you could essentially still use the numeric ID field.

Instead I added a computed column to my dataset that uses the FORMAT() function to convert the existing numeric ID field to a string.

Embedded-Sample-New-Computed-Column

Then I based my role on that column, still using the Username() function.

Embedded-Sample-Using-RegionID-Role

Now I can filter based on the ID field, WooHoo!

Embedded-Sample-Final-Using-RegionID

Thanks Dave Ruijter for making me think about this a little bit more.