Archive for the ‘SQL Server Bloggers’ Category

Behavior of Power View in Excel 2013 within SharePoint 2013

Saturday, May 25th, 2013

Overview:  A quick post about what to expect when integrating Power View worksheets embedded in Excel 2013 into a SharePoint 2013 site.  Note that this behavior is a temporary situation…I’m guessing the SharePoint team at Microsoft is planning to getting full integration with Power View working.  Should just be a matter of time. 

Versions Applicable:  This behavior I’ve observed is applicable to Excel 2013 (i.e., the only version of Excel that supports embedding Power View worksheets) with SharePoint 2013.

First, let’s take a peek at the original Excel file.  This first screen shot is from the Excel application, before it’s been uploaded to SharePoint.  Note that there are 5 worksheets, 2 of which are Power View.

     image   

Next, let’s look at how the Excel file appears in SharePoint.  This next screen shot is from a PowerPivot Gallery in SharePoint 2013.  Note the display of an icon at the bottom right of each thumbnail preview – the tooltip for these reads “The document contains more items than can be displayed by the PowerPivot Gallery.” 

     image

Next we’ll click on the Excel file to render it interactively using Excel Services.  Note that the Power View worksheets do appear along the bottom.  Note also that the interactivity functionality is present.  That’s the good news!  (Keep reading for the bad news…)

     image

Next let’s download the workbook from SharePoint by doing a File > Save As > Download.  We are then presented with a dialog box stating “Features that we can’t show in the browser and interactive reports will be removed from the downloaded copy.  Continue with the download?”   Say Yes.

     image

     image

After selecting a location for the downloaded file, open it in Excel.  Guess what we see in the downloaded version of the file?  You got it…only 3 worksheets.  The 2 Power View worksheets were not retained because they’re not yet fully supported.

     image

The moral of the story here?  Until we have a release that fully supports Power View embedded within Excel, hang onto your original Excel file!

 

Reblog: May 17 to May 23

Friday, May 24th, 2013

BookWelcome to this Friday’s reblog summary post.  The aim of these posts is to bring some old posts that newer readers may not have seen back to the forefront.  As with many technology blogs, just because a post is old, doesn’t mean it doesn’t still have value.

Some posts from years gone by that you may have missed are:

Do you have something from years gone by that was posted during this week?  If so, leave a comment below and we’ll give some new life to good knowledge.

New Treemap, Histogram and Streamgraph Apps for Excel 2013

Friday, May 24th, 2013

I blogged about the new app model for Office 2013 and what it means for BI last year, but since then there hasn’t exactly been a massive flood of new data visualisation apps. However… yesterday, I was interested to see that some new apps had been published by the Visualization and Interaction for Business and Entertainment team at Microsoft Research. You can read all the details in this blog post:
http://blogs.technet.com/b/inside_microsoft_research/archive/2013/05/23/new-ways-to-visualize-your-data.aspx

The new apps (which are all free) are:

To test the Treemap out, I used Data Explorer to get the overall size on disk of the contents of the folders I use to store my presentation materials; I won’t go into detail about how I did it, but Erik Svenson has a great post on how to do this here. I ended up with a the following treemap:

image

It’s worth pointing out one cool thing about these apps: they still work when your worksheet is deployed to Sharepoint and viewed in a browser with the Excel Web App, even in Office 365!


Security Questions: Differences between “Grant” and “With Grant?”

Thursday, May 23rd, 2013

PadlockAs I mentioned in the introductory post, in the Introduction to SQL Server Security session for Pragmatic Work’s Training on the T’s, I received a large number of questions that there wasn’t time to answer.  Instead of just a re-cap of all of the questions, instead I’ve opted to put together a post per topic.  Hopefully, this will help, not just those that attended the session, but also anyone searching for the same questions later on.

THE GRANT question

The third question in the list is:

Can you please expound on the difference between “Grant” and “With Grant?”

When you GRANT something within SQL Server, that provides the permissions required to access the object, or securable, that is included in the statement.  For instance, a GRANT of read permissions on a tables allows the person to read from the table.

The WITH GRANT option, requires that Grant Fritchey (Blog | @GFritchey) show up for any of your permissions to work.  No, that’s not right.

In all seriousness, the WITH GRANT option allows the person who has been granted access to an object to GRANT that same access to other principals.  It is basically a method for delegating permissions when you have someone you can trust to manage those permissions.

Generally,  I’m not a big fan of this option.  The main reason is that, as a DBA, I’ve tended to be more concerned with who has permissions within a database compared to others.  The frequency in which I’ve seen others over grant permissions has been disheatening, especially when I was an FTE DBA and working on trying to constrain all of the run-away permissions.  That said, as a team member, we can’t always hold all of the cards and granting a junior DBA or team lead in another department the option to grant permissions through delegation can be especially handy.

Demo

To demonstrate how WITH GRANT works, let’s run a couple GRANT statements in AdventureWorks2012.  We’ll start by creating two new logins, WithGrantLogin1 and WithGrantLogin2, using the script in Listing 1.  The last part of the script includes a GRANT statement for WithGrantLogin1 provide access to Sales.SalesOrderHeader.  At the end of the GRANT, notice that “WITH GRANT OPTION” is included.  That is the clause that allows WithGrantLogin1 to have the permissions required to assign that GRANT to other users.



--Listing 1. Create new login
USE [master]
GO
CREATE LOGIN [WithGrantLogin1] WITH PASSWORD=N'pass@word1'
, DEFAULT_DATABASE=[master]
, CHECK_EXPIRATION=ON
, CHECK_POLICY=ON
GO

CREATE LOGIN [WithGrantLogin2] WITH PASSWORD=N'pass@word1'
, DEFAULT_DATABASE=[master]
, CHECK_EXPIRATION=ON
, CHECK_POLICY=ON
GO

USE [AdventureWorks2012]
GO

CREATE USER [WithGrantLogin1] FOR LOGIN [WithGrantLogin1]

CREATE USER [WithGrantLogin2] FOR LOGIN [WithGrantLogin2]

GRANT SELECT ON Sales.SalesOrderHeader TO [WithGrantLogin1] WITH GRANT OPTION

To test this out, open two query windows and login to each of them with one of the two new users.  After doing so, run the script in Listing 2 in each of the two query windows, once for each of the users.  As you might expect, the query will succeed for WithGrantLogin1, but fails for WithGrantLogin2.


--Listing 2. Query Sales.SalesOrderHeader
USE AdventureWorks2012
GO

SELECT * FROM Sales.SalesOrderHeader

In the query window for WithGrantLogin1, run the script in Listing 3.  This script; which does not include the WITH GRANT OPTION, will GRANT read permissions to WithGrantLogin2 on Sales.SalesOrderHeader.  You should now be able to successfully run the query in Listing 2 for WithGrantLogin2.



--Listing 3. Create new login
GRANT SELECT ON Sales.SalesOrderHeader TO [WithGrantLogin2]

For the DBAs reading this, one of your first concerns with using the WITH GRANT clause for the GRANT statement is auditing how permissions have been assigned.  Fortunately, through SQL Server’s catalog views, this information is easy to discern.  With the catalog view sys.database_permissions, there are columns that identify both the grantee and the grantor for permissions.  Joining the view to sys.database_principals provides the names associated with the principal_ids and the names associated with accepting and granting permissions.  Using the query in Listing 4 and output in Figure 1, you can see that there is an audit trail of both who has and who granted permissions.


--Listing 4. Review permissions and the grantor
SELECT dp.class
,dp.class_desc
,dp.permission_name
,dp.state_desc
,OBJECT_NAME(dp.major_id) AS object_name
,dp2.name AS grantee_principal
,dp1.name AS grantor_principal
FROM sys.database_permissions dp
left JOIN sys.database_principals dp1 ON dp.grantor_principal_id = dp1.principal_id
left JOIN sys.database_principals dp2 ON dp.grantee_principal_id = dp2.principal_id

SysPermissionsOutput
Figure 1. Sys.permissions output

Summary

When it comes to granting permissions, using the WITH GRANT OPTION might not be my favorite security command.  But it is a very useful option for delegating permissions, and potentially freeing DBAs from mindless tasks to more fun tasks, like performance tuning.  Properly leveraging this option is something that definitely should be a consideration.  What do you think?  Do you use the WITH GRANT OPTION in your environment?

I’m presenting at the PASS Summit!

Thursday, May 23rd, 2013

passsummit

I am fortunate enough to have been selected to give a presentation at the PASS Summit 2013 in Charlotte, NC on October 14-18.  It’s amazing to think that, although I have been in IT for 25 years, I first started to build my brand when I started this blog only 25 months ago (April 2011), and I have already got to the point where a session of mine has been accepted to “the big show” (I guess I have made it Big Time).  But you know what?  You can do it to!  And here is how: Enhance your career by blogging!, How to use LinkedIn to enhance your career, Blueprint for consulting riches, How to become an expert in your field, ABL: Always Be Learning, DBA’s, want to earn the big bucks? Learn BI, PASS Business Analytics Conference: the ultimate networking

Below is my presentation abstract along with more info about the conference.  I hope to see you there!

Building an Effective Data Warehouse Architecture

You’re a DBA and your boss asks you to determine if a data warehouse would help the company.  So many questions pop into your head: Why use a data warehouse?  What is the best methodology to use when creating a data warehouse?  Should I use a normalized or dimensional approach?  What is the difference between the Kimball and Inmon methodologies?  Does the new Tabular model in SQL Server 2012 change things?  What is the difference between a data warehouse and a data mart?  Is there any hardware I can purchase that is optimized for a data warehouse?  What if I have a ton of data?  During this session James will help you to answer these questions so your response to your boss will provoke amazement and lead to a big raise.  Or at least help to lead you down the correct path!

PASS Summit 2013

PASS Summit is the world’s largest and most intensive technical training conference for Microsoft SQL Server and BI professionals.  But more than that, it’s your conference – planned and presented by the SQL Server community for the SQL Server community.

More info:

51 Questions About Your #SQLPASS Summit Submission

Tips for Getting Around Charlotte at PASS Summit

Using Scoped Assignments To Show Calendar and Financial Year-To-Date Values In The Same Calculated Measure

Thursday, May 23rd, 2013

I’ve had a lot of requests for more MDX content on my blog, so here’s something I’ve been meaning to write up for a long time: a worked example of how to use scoped assignments to implement two different types year-to-date calculation on two different hierarchies in the same dimension. Knowledge of how to use scoped assignments is the sign of a true MDX master (you can watch a video of a session I gave on the basics of scoped assignments at SQLBits here if you’re unfamiliar with them) but that’s because they can be very difficult to write and there’s surprisingly little information out there on the internet about them. They are incredibly powerful, though, and often they provide the most elegant and best-performing way to solve a problem.

Let’s start by looking at the Date dimension in the Adventure Works DW sample database, and more specifically the attributes, user hierarchies and attribute relationships:

image

image

Notice how we have two user hierarchies for Calendar Years (which start on January 1st) and Fiscal Years (which start on July 1st), called Calendar and Fiscal. Now, let’s say that you have a requirement to to show year-to-date values for a measure for both the Calendar and Fiscal hierarchies. It would be very easy to implement this as two separate calculated measures but what if you needed to show both types of year-to-date in the same calculated measure, showing Fiscal year-to-dates when the Fiscal hierarchy was used in a query and Calendar year-to-dates when the Calendar hierarchy was used in a query?

This is possible using scoped assignments. The first thing to point out, though, is that this is only going to be possible if you change the structure of the dimension. Why? Well, take a look at the Date levels of both hierarchies: they are both built using the Date attribute. If you were running a query with your YTD calculation on columns and only the Date attribute hierarchy on rows, would you expect to see Calendar or Fiscal YTD values? Certainly you couldn’t see both in the same cell, and this is the problem: if you expect to see Calendar YTD values at the bottom of your Calendar hierarchy, and Fiscal YTD values at the bottom of your Fiscal hierarchy, you need two separate Date attributes to do this. If you overwrite the values in the same cells twice using a scoped assignment, then you will only see the result of the second assignment.

Therefore, what we need to do is to create two new attributes, Calendar Date and Fiscal Date, to serve as the lowest levels of the Calendar and Fiscal hierarchies instead of the Date attribute. Here’s what the new attribute relationships look like:

image

From the end-user’s point of view nothing seems to have changed (these new attributes can have their AttributeHierarchyVisible property set to False) but this now means we have two attributes, two different slices of the cube, whose values we can overwrite separately instead of just one.

Now for the MDX. A good rule to follow when writing scoped assignments is to always use attribute hierarchies and never use user hierarchies; this is because there are rules you have to obey about the shape of the subcube of data you are overwriting with your scoped assignment. When defining a scope using only attribute hierarchies, you can only use the following types of set:

  • Every single member on the attribute hierarchy
  • Just one member on the attribute hierarchy
  • Multiple members on the attribute hierarchy not including the All Member

I wrote up a detailed set of rules for defining scopes in MDX Solutions, if you’re interested; if you don’t follow these rules you’ll get the infamous “An arbitrary shape of the sets is not allowed in the current context” error (I know a joke about that, incidentally).

For this calculation, we need to make two scoped assignments on a single calculated measure called [YTD Sales]: one to show the Fiscal YTD calculation for the Fiscal Date, Fiscal Month Name, Fiscal Quarter, Fiscal Semester and Fiscal Year attributes; and one to show the Calendar YTD calculation for the Calendar Date, Calendar Month Name, Calendar Quarter, Calendar Semester and Calendar Year attributes. When scoping on ranges of attributes like this, there’s another easy rule to follow: scope on the set of every member, including the All Member, from the attribute hierarchy at the lowest granularity attribute, and the set of every member, not including the All Member, from the highest granularity attribute. These two sets also need to be in the same, rather than separate, SCOPE statements for reasons I explain here.

This results in the following MDX:

CREATE MEMBER CURRENTCUBE.MEASURES.[YTD Sales] AS NULL;

 

SCOPE(MEASURES.[YTD Sales]);

    --Calendar YTD

    SCOPE([Date].[Calendar Date].MEMBERS, [Date].[Calendar Year].[Calendar Year].MEMBERS);

        THIS = AGGREGATE(

                PERIODSTODATE([Date].[Calendar].[Calendar Year], [Date].[Calendar].CURRENTMEMBER), 

                [Measures].[Internet Sales Amount]);

    END SCOPE;

    --Fiscal YTD

    SCOPE([Date].[Fiscal Date].MEMBERS, [Date].[Fiscal Year].[Fiscal Year].MEMBERS);

        THIS = AGGREGATE(

                PERIODSTODATE([Date].[Fiscal].[Fiscal Year], [Date].[Fiscal].CURRENTMEMBER),

                [Measures].[Internet Sales Amount]);

    END SCOPE;

END SCOPE;

Now you can see the YTD Sales calculated measure returns Calendar YTD values for the Calendar hierarchy:

image

…and it returns Fiscal YTD values for the Fiscal hierarchy:

image

There’s one last trick I want to show. It can be very difficult to know that your scoped assignment is covering the subcube you want it to cover, so while debugging scoped assignments I find it helps to assign values to the BACK_COLOR cell property so I can see exactly where I’m scoping. Here’s the MDX above with extra assignments to set the cell background colour to orange for the Calendar YTD calculation and blue for the Fiscal YTD calculations:

CREATE MEMBER CURRENTCUBE.MEASURES.[YTD Sales] AS NULL;

 

SCOPE(MEASURES.[YTD Sales]);

    --Calendar YTD

    SCOPE([Date].[Calendar Date].MEMBERS, [Date].[Calendar Year].[Calendar Year].MEMBERS);

        THIS = AGGREGATE(

                PERIODSTODATE([Date].[Calendar].[Calendar Year], [Date].[Calendar].CURRENTMEMBER), 

                [Measures].[Internet Sales Amount]);

        BACK_COLOR(THIS) = RGB(255,128,64);

    END SCOPE;

    --Fiscal YTD

    SCOPE([Date].[Fiscal Date].MEMBERS, [Date].[Fiscal Year].[Fiscal Year].MEMBERS);

        THIS = AGGREGATE(

                PERIODSTODATE([Date].[Fiscal].[Fiscal Year], [Date].[Fiscal].CURRENTMEMBER),

                [Measures].[Internet Sales Amount]);

        BACK_COLOR(THIS) = RGB(64,128,255);

    END SCOPE;

END SCOPE;

This now shows up in an Excel PivotTable as you can see below:

image

image

It can also help you understand what’s going on in the scenarios where the scopes overlap, for example if you put the Calendar and Fiscal hierarchies on rows and columns in the same PivotTable: the Fiscal hierarchy takes precedence, because it’s defined second.

image


Business Objects on Linux and SQL Server

Thursday, May 23rd, 2013

This is just a quick post to share a lesson learned while I was on an engagement where the client’s reporting environment was using SAP Business Objects (BO)running on Linux for reporting. We were doing a test to move the underlying data warehouse from another database platform to SQL Server 2008 R2.

As we changed connections over, however, we quickly ran into a roadblock. It seems when we tried to make a connection to SQL Server via BO we got the error of ‘Unable to bind to Configuration Objects WIS 10901′. What made this situation strange is that from a Windows box you could connect but from Linux itself, it wasn’t having any of it. After some digging around we found we needed a third party ODBC driver to make this connection work.

It was suggested to us by the folks at SAP that we use a third party driver for ODBC connectivity. We were pointed to drivers by DataDirect (NOTE: This is not an endorsement for said product, this is simply the solution we tried and went with. There are several third party vendors that offer Linux ODBC connectivity so please evaluate and choose what works for your environment). Have you run in to this issue before? How’d you handle it? Feel free to share your solutions in comments.

Share

Is Your Code an English Garden or Ikebana?

Thursday, May 23rd, 2013

Erika loves having fresh flowers around the house. Every Saturday morning, I pick up a bouquet at a farmer’s market or grocery store and put it in a vase for her. I’m slowly upping my game by learning more and more about the art of arranging flowers.

When I say flowers, I bet you think about the English Garden style: a big, complex vase with all kinds of flowers crammed into every nook and cranny. It’s an explosion of color and life.

Photo Source: Conveyor Belt Sushi

That’s way too stuffy for us. We’re into minimalism, clean lines, and letting materials speak for themselves. I like plucking one or two of the more beautiful or unusual flowers and putting them in their own vase. This leans toward the Ikebana style of Japanese flower arrangement, specifically the Nageire type. (I don’t even want to think about how badly I’m going to mispronounce these if I ever have to say them out loud.)

Writing database code is like arranging flowers.

If you show someone your bouquet, they might not like it. They might give you a million reasons about why it’s not right or why another way is better. That’s not the point – does it produce the results you want?

If your goal is to get to market quickly and cheaply, just buy a premade bouquet from the grocery store, throw the flowers in the vase and be done with it. Use LINQ, Entity Framework, NHibernate, or whatever code tools make your job easy.

If you translate your app code into SQL code, you’re building an English Garden. You start by declaring variables at the center, then populating those variables by checking configuration tables, then spin out to more and more other tables, getting your results in loops and setting values one at a time. This is exactly how developers have always been taught to arrange their flowers, and it works just fine. Once you’re used to doing it, you can bang that code out quickly, and the results are attractive.

But if you need it to be beautifully fast, you need Ikebana. You need very clean, very minimalist code that gets the job done in as few statements as possible. In a database environment, this means set-based code that avoids cursors and loops.

While clean, Ikebana-style database code is simple to behold, it’s deceivingly complex to build. The first step is moving as much logic as possible from the database server to the application server – starting with the ORDER BY statement. If you’re not fetching just the TOP X rows, then do all sorting in the application server. Removing just that one line from a query will often cut its cost dramatically. Your development platform (.NET, Java, Cobol, whatever you kids are using these days) is really good at scaling out CPU and memory-intensive work like sorting, and you’re already really good at splitting out your work into multiple application servers. Leverage that capability.

Think of it like pruning your code – remove all the things that database servers don’t do beautifully, and what you’re left with will be gorgeous.

...
Just check the boxes to see Bad DBA Job Detector, Top 3 Indexing Mistakes, and the DBAReactions Guide to Database Administration.

The Journey is the Reward: Speaking for SQLPass, where do you start?

Thursday, May 23rd, 2013
I'm heartened by the numbers of people who are expressing an interest in speaking at events. In particular, I understand that SQLPass had record numbers of people submitting to SQLPass Summit in Charlotte this year. For me, this is especially important because it suggest that more people are interested in speaking and sharing their SQL Server knowledge. It also shows that the community are supportive of a SQLPass Summit event in Charlotte. This energy shows the strength of the event itself, rather than being tied to a particular location i.e. Seattle. As much as I love Seattle, I have never been to Charlotte and I'm excited to be visiting a new part of the United States. In case you are wondering, I am Scottish :)

I am not part of the session selection process for SQLPass so this blog is based on my insights from the community only.  How do you get experience so that you can speak for events, perhaps with the goal of speaking at the SQLPass Summit event, which is the pinnacle of every SQL Server guru's career?

It can seem to be a vicious cycle: you can't speak because you don't have experience, and you don't get experience because you don't speak.

This isn't true!

There are plenty of opportunities to speak and here are some:

Come and join me and give a webinar for the Data Warehousing and Business Intelligence Virtual Chapter. This is a great way to start and you will have the full support of myself and Julie Koesmarno, who helps with the Chapter as I do. We can help you to get started. The sessions last for about one hour, and we do 45 minutes talk, and then 15 minutes of questions.  Why not give it a go?

Your local PASS Chapter - come and attend your local user Group, and see how you can get involved. Take a look at the PASS site for some thoughts

Your workplace - why  not try a 'brown bag lunch' session, whereby you and your team all take turns to present on something? It is a safe environment to learn, and you might even enjoy it!

If you didn't get a slot at SQLPass Summit this time - don't be disheartened. There is a Chinese proverb: The journey is the reward. Keep going, and who knows what will happen? You'll learn, and make friends as you go along. Submit again next year with more experience under your belt, and more knowledge of your subject. Good luck!

A special note for UG leaders - make sure and support your new speakers. Mentor and encourage them. That person might be the next Brent Ozar or Kalen Delaney, so give them the opportunity to grow. We are all part of a community and we can help one another!

Good luck everyone! Please email me at jen.stirrup@copperblueconsulting.com if you'd like to give a webinar. I'd love to schedule you in, and help you get started!

Best,
Jen x



Big Data for the Business Intelligence Professional SQLPass Summit Preconference Day

Wednesday, May 22nd, 2013
I'm delighted to announce that Allan Mitchell (blog ¦ twitter) and I are giving a Big Data for the Business Intelligence Professional preconference session at SQLPass Summit 2013 in Charlotte, NC.

What will we be covering?

What does Big Data mean for business intelligence professionals? Come see the “whats,” “hows,” and “whys” as this full-day pre-conference session demystifies Microsoft’s Big Data technology offerings. 
Microsoft has partnered with HortonWorks to bring Big Data into the hands of business users via their favorite BI tools: Power View, PowerPivot, and Excel. This session will cover both on-premise and Azure-based technologies, examining the Microsoft distribution of Hadoop through a range of technologies such as HDInsight, Hive, and Azure through to Excel, PowerPivot, and Power View. 

The first half of the session will be dedicated to the “what” and “how” of Hadoop, using HDInsight. With Hadoop comes a whole ecosystem of tools, and we’ll look at how to use them in a BI context to support users’ Big Data needs. We’ll also look in detail at MapReduce to parallelize complex Big Data queries across many servers. After you have Big Data, how are you going to serve it to business users to derive value for the enterprise? 

The second half of the session will be dedicated to the “why” of Big Data. We’ll visualize Big Data in our favorite BI tools: Excel, PowerPivot, and Power View.

Would you like to join us? 

We'd love to see you there! Visit the PASS Summit 2013 website for the latest updates.  You can also take advantage of early registration, so book now to register at $800 off the final registration rate by June 30.

What is SQLPass Summit? 

It is the conference which is the pinnacle of the SQL Server world, featuring over 125 hand-picked sessions to help data professionals advance their careers and make the most of their Microsoft SQL Server implementations. The conference takes place on October 15th - 18th.

Presentations across 6 tracks will cover everything from database administration best practices, new SQL Server features, and the latest database and application development techniques to what you need to know about building and managing effective BI solutions and being successful in the cloud.