Business Intelligence Blogs

View blogs by industry experts on topics such as SSAS, SSIS, SSRS, Power BI, Performance Tuning, Azure, Big Data and much more! You can also sign up to post your own business intelligence blog.

«October 2015»

Data Warehouse from the Ground Up at SQL Saturday Orlando, FL on Oct. 10th

SQL Saturday #442SQL Saturday #442 is upon us and yours truly will be presenting in Orlando, Florida on October 10th alongside Mitchell Pearson (b|t). The session is scheduled at 10:35 AM and will last until 11:35 AM. I’m very excited to be presenting at SQL Saturday Orlando this year as it’ll be my first presenting this session in person and my first time speaking at SQL Saturday Orlando! If you haven’t registered yet for this event, you need to do that. This event will be top notch!

My session is called Designing a Data Warehouse from the Ground Up. What if you could approach any business process in your organization and quickly design an effective and optimal dimensional model using a standardized step-by-step method? In this session I’ll discuss the steps required to design a unified dimensional model that is optimized for reporting and follows widely accepted best practices. We’ll also discuss how the design of our dimensional model affects a SQL Server Analysis Services solution and how the choices we make during the data warehouse design phase can make or break our SSAS cubes. You may remember that I did this session a while back for Pragmatic Works via webinar. I’ll be doing the same session at SQL Saturday Orlando but on-prem! ;)

So get signed up for this event now! It’s only 11 days away!

Read more

Create Date Dimension with Fiscal and Time

Here are three scripts that create and Date and Time Dimension and can add the fiscal columns too. First run the Dim Date script first to create the DimDate table. Make sure you change the start date and end date on the script to your preference. Then run the add Fiscal Dates scripts to add the fiscal columns. Make sure you alter the Fiscal script to set the date offset amount. The comments in the script will help you with this.

This zip file contains three SQL scripts.

Create Dim Date

Create Dim Time

Add Fiscal Dates

These will create a Date Dimension table and allow you to run the add fiscal script to add the fiscal columns if you desire. The Create Dim Time will create a time dimension with every second of the day for those that need actual time analysis of your data.

Make sure you set the start date and end date in the create dim date script. Set the dateoffset in the fiscal script.

Download the script here:


Read more

Excel Tip #29: Forcing Slicers to Filter Each Other when Using CUBE Functions

As I mentioned in my original post, Exploring Excel 2013 as Microsoft’s BI Client, I will be posting tips regularly about using Excel 2013 and later.  Much of the content will be a result of my daily interactions with business users and other BI devs.  In order to not forget what I learn or discover, I write it down … here.  I hope you too will discover something new you can use.  Enjoy!


You have went to all the trouble to build out a good set of slicers which allow you to “drill” down to details based on selections. In my example, I have created a revenue distribution table using cube formulas such as:

=CUBEVALUE(“ThisWorkbookDataModel”,$B6, Slicer_Date, Slicer_RestaurantName, Slicer_Seat_Number, Slicer_TableNumber)


Each cell with data references all the slicers. When working with pivot tables or pivot charts, the slicers will hide values that have no matching reference. However, since we are using cube formulas the slicers have no ability to cross reference. For example, when I select a date and a table, I expect to see my seat list reduce in size, but it does not. All of my slicers are set up to hide options when data is available. There are two examples below. In the first, you can see that the seats are not filtered. However, this may be expected. In the second example, we filter a seat which should cause the tables to hide values and it does not work as expected either.



As you can see in the second example, we are able to select a seat that is either not related to the selected table or has no data on that date. Neither of these scenarios is user friendly and does not direct our users to see where the data matches.

Solving the Problem with a “Hidden” Pivot Table

To solve this issue, we are going to use a hidden pivot table. In most cases we would add this to a separate worksheet and then hide the sheet from the users. For sake of our example, I am going to put the pivot table in plain sight for the examples.

Step 1: Add a Pivot Table with the Same Connection as the Slicers

In order for this to work, you need to add a pivot table using the same connection you used with the slicers. The value you use in the pivot table, should only be “empty” or have no matches when that is the expected result. You want to make sure that you do not unintentionally filter out slicers when data exists. In my example, I will use the Total Ticket Amount as the value. That will cover my scenario. In most cases, I recommend looking for a count type valu

Read more

SQL Internals Reading Data Records Part 3: Fixed Length Columns

  • 29 June 2012
  • Author: BradleyBall
  • Number of views: 3833

Hello Dear Reader and welcome back to part 3 of our ongoing series on how to Read a Data Record. 

It is Friday just before the weekend, and now we are getting to the part of the record that means a great deal to us. 

Not that the Tag Bytes and Null Bitmap offset weren’t important but now we are finally out of the meta data and into OUR DATA.  The data that we as DBA’s store or that our users store.

So I’ll dispense with the turn of the phrase and dive directly into our data.



First let’s update our chart so we know what part of the Data Record we are tackling.  Once again these images come by way of Paul Randal (@PaulRandal | Blog) and the MCM Video series on Data Structures and the good people from Microsoft.


Our Fixed Length Columns are any data type that always uses the defined amount of space.  They are BIGINT, INT, FLOAT, DECIMAL, MONEY, CHAR, NCHAR, BIT, SMALLMONEY, MONEY, REAL, DATETIME, DATETIME2, DATETIMEOFFSET, and BINARY.  As mentioned these fields will use 100% of the space assigned to them regardless of the length of the data stored within them.  For example if I define a CHAR(500) and we insert ‘Some Product’, which is 12 characters long 1 byte per character means 12 bytes for storage, we will have 488 bytes of left over space.  If we have an Integer it always uses 4 bytes even if the number only needs 1 byte of space.  Before I break down into a Compression blog let’s just go straight into our record.


The scripts we’ve been using from our previous blogs created a fixed length record that was 1504 bytes which is a little much to put on a page, but the second table we created yesterday that had just two fields and took up  9 bytes would work out well.  So here’s the code if you need it.


CREATE TABLE fixedRecord
         myID INT
        ,mychar CHAR(5)
INSERT INTO dbo.fixedRecord(myid, mychar)
VALUES(1, 'X')


Don’t forget we’ll use DBCC IND to get our page number.


DBCC IND(demoInternals, 'fixedRecord', 1)


Then we’ll set Trace Flag 3604 on and use DBCC PAGE to look at the output.


DBCC PAGE('demoInternals', 1, 282, 3)


Here is the output greatly paired down just to what is relevant to us. 

0000000000000000:   10000d00 01000000 58202020 20020000           ........X    ...


The record we inserted was (1,X) our 1 will be highlighted in red and our X in orange.  We need to remember that each section of code grouped together in groups of two hexadecimal digits in 4 byte segments.  So that means everything in red makes up a perfect 4 byte segment because it is and INT data type, our CHAR(5) takes up all of one segment and two digits, a hexadecimal pair, in orange. 


Now that we have them grouped we can start translating them.  The trailing 0’s in 01000000 represent the empty unused space in the Integer field.  Our value 01 translates to 0x01 which equals 1, if you want you can convert it to validate  Our next record will be a little more interesting 58202020 20.  The first part that we are interested in if 58, we’ll use our converter tool to convert that from Hex to binary, 01011000.  Our next step is to find out what the binary value actually translates to in text.  For that we’ll use another conversion tool, just plug in 010110000 and we see that it is binary for the letter X.


“So Balls”,  you say, “What are all the 202020’s for then?”


Dear Reader your keen powers of perception never fail to amaze me!  The 202020 20’s are the white space left over in the CHAR(5) field.  Remember we only need 1 byte worth of space for our letter X, but our CHAR(5) takes up 5 bytes no matter what.  If you take a 20 and place it into our handy Hex converter you get the binary value of 00100000, which when converted to ASCII is a simple space.   So 58 is our X and 202020 20 are the 4 spaces in the record as well.




While we have a choice in using CHAR and VARCHAR data types and whether we waste white space or not, we do not have that option with Integers or Dates and Times, which is a perfect reason to start learning about SQL Server Compression and reclaim some of that wasted space.


Thanks again for stopping by Dear Reader.





Categories: Analysis Services
Rate this article:
No rating


Other posts by BradleyBall

Please login or register to post comments.