Archive

Posts Tagged ‘PowerPivot’

Denali PowerPivot: new DAX functions that will make your life easier

July 13th, 2011 2 comments

In Denali a couple of new functions are introduced that will make your DAX writing life a little easier. This blog post will cover the most interesting new functions that are available in Denali.

The first one that I want to cover is DistinctCount(), lets say we want to count the distinct number of customers for a given year we only have to do a formula like this:

=DISTINCTCOUNT(Sales[CustomerKey])

as easy as that :)

 

Another great improvement is the HASONEVALUE function. Lets say you want to do a running total over all the year. That would be a measure like this:

=CALCULATE([Sum of SalesAmount], DateTable[CalendarYear] <= VALUES(DateTable[CalendarYear]))

But putting this in a pivottable would give you a error:

ERROR – CALCULATION ABORTED: Calculation error in measure ‘DateTable’[Measure 1]: A table of multiple values was supplied where a single value was expected.

So you need to wrap a check around this function to make sure that this function is only executed for a single year and not for the grand total, that would look like this:

=if(COUNTROWS(VALUES(DateTable[CalendarYear])) =1,

CALCULATE([Sum of SalesAmount], DateTable[CalendarYear] <= VALUES(DateTable[CalendarYear])), BLANK())

In denali we can write it like this:

=if(HASONEVALUE(DateTable[CalendarYear]),

CALCULATE([Sum of SalesAmount], DateTable[CalendarYear] <= VALUES(DateTable[CalendarYear])), BLANK())

 

In Denali the Search function has an extra parameter that let’s you return a value if nothing is found. In 2008 R2 if no value is found the function will throw an error, which makes this function not easy to work with.

Now you can just do this:

=SEARCH(“Dollar”,Currency[CurrencyName],1,-1)

It will return -1 if no string is found that matched “Dollar”.

 

Another function that will make you life easier when writing DAX is the Switch function. Let say you want to have a measure that behaves differently for each productgroup. In 2008 R2 you had to write:

=if(values(category[type]) = 1,sum(Sales[Amount]) * 2,
if(values(category[type]) =2, sum(Sales[Amount]) * 4,
if(values(category[type])=3, sum(Sales[Amount]) * 6,
sum(Sales[Amount])))

In Denali we can write the following:

=Switch(values(category[type]),
1, sum(Sales[Amount]) * 2,
2, sum(Sales[Amount]) * 4,
3, sum(Sales[Amount]) * 6,
sum(Sales[Amount]))

Much simpler and easier to read.

Keep posted for more new DAX functions and Denali tips and tricks to come in next weeks.

Categories: DAX, PowerPivot Tags: ,

Powerpivot CTP3: What is new for Time Intelligence functions

July 12th, 2011 4 comments

Time Intelligence functions are not new in SQL Server Denali. But in Denali we have made working with these functions a little easier and flexible.  To use these one of these functions in 2008 R2 DAX you used to apply some rules: http://www.powerpivotblog.nl/powerpivot-time-intelligent-functions-golden-rules.

The rules in SQL 2008 R2 were the following:

  1. Never use the datetime column from the fact table in time functions.
  2. Always create a separate Date table.
  3. Make sure your date table has a continues date range
  4. Create relationships between fact tables and the Date table.
  5. Make sure that relationships are based on a datetime column (and NOT based on another artificial key column).
  6. The datetime column in the Date table should be at day granularity (without fractions of a day).

With the release of Denali we have changed these to the following:

  1. Never use the datetime column from the fact table in time functions.
  2. Always create a separate Date table.
  3. Make sure your date table has a continues date range
  4. Create relationships between fact tables and the Date table.
  5. The datetime column in the Date table should be at day granularity (without fractions of a day).
  6. Mark the Date table as a Date Table in PowerPivot and set the Date column.

So what is changed here? In Denali your date table can have a column that is related to the fact table that is not of the type Date.  This is a situation most datawarehouses will have set up. Most data warehouses will have a fact table that is joinedwith a date table based on a column that is an integer value. In 2008 R2 PowerPivot getting this to work was very hard.

In Denali all we have to do in PowerPivot / BIDS is make sure that our model knows which table is a date table and what column is a date column. The reason we need to supply DAX with a date column is that DAX needs to know how to apply its time intelligence functions, if you have an integer column like 20031010 how does DAX then know how to subtract a year?

Open the PowerPivot window, select the date table, go to design and click Mark as Date Table:

This will prompt you a dialog. In this dialog you can select the column that contains your date values:

This will result in two things:

  • Time intelligence function will now work using this table
  • Excel is aware that that columns from this table are Date columns and the specific Excel time related filters are now enabled:

As you can see this small operation has big effects :)

Categories: DAX, PowerPivot Tags: ,

Microsoft SQL Server Code Name “Denali” Community Technology Preview 3 (CTP3)

July 12th, 2011 1 comment

Finally the long wait (for me at least) is over. As of today you can download the CTP3 PowerPivot and BIDS. CTP means Community Technology Preview meaning that this is a preview of the final product. But it is very rich in features ! I will do multiple blogpost over the next weeks explaining a lot of the new features.

My collegue Kay Unkroth has created a great blogpost summarizing the release which you can find here. Another big part of this release is Project Crescent which uses PowerPivot and Tabular projects as source. Read this blog post by the RS team for more information about Crescent.

Download PowerPivot 64 bits here.

Download SSAS server including the tabular service, BIDS and Crescent here.

Have fun with the CTP and let me know what you think ! Ow and most of all don’t forget to file bugs / suggestions on connect if you want your voice to be heard by the product team, see here why and how.  To directly go to the SQL server connect page go here: https://connect.microsoft.com/SQLServer/Feedback  and add your feedback.

Categories: PowerPivot Tags:

PowerPivot and SharePoint 2010 SP1: Get it now !

June 28th, 2011 No comments

Hot from the press: SharePoint 2010 SP1 has been released. With it come some great performance gains for PowerPivot in SharePoint.

Check out the details here.

Get SP1 here.

Sample Application Released: Analytics for Twitter

June 13th, 2011 No comments

Last week, Microsoft released Microsoft Analytics for Twitter, an awesome PowerPivot application to query Twitter within Excel 2010 and perform ad-hoc analysis on Tweet statistics, such as time and frequency of tweets, top tweets, top tweeters, and so forth. The Microsoft Analytics for Twitter application even detects the tone score (see screenshot) based on keywords that you can customize in the workbook.

Useful links:

Download Microsoft Analytics for Twitter http://go.microsoft.com/fwlink/?LinkId=221191
Wiki Help for Troubleshooting http://go.microsoft.com/fwlink/?LinkId=221192

Categories: DAX, PowerPivot Tags: ,

Using SharePoint List Data in PowerPivot

June 8th, 2011 3 comments

My colleague Uday Unni created a very interesting white paper on “Using SharePoint List Data in PowerPivot”:

One of the many features of Microsoft SQL Server PowerPivot is the range of data sources that can be used to import data. Anything, from Microsoft SQL Server relational databases, Oracle databases, and Microsoft Access databases, to text documents, can be used as data sources in PowerPivot. In this paper, I explain one of the new and upcoming data sources that people are excited about – SharePoint list data in the form of Atom feeds. This white paper goes on to explain the different ways you can import SharePoint list data into PowerPivot, what types of lists are supported, various components that need to be installed to use this feature, and where to get those components.

download the entire whitepaper here.

 

Categories: PowerPivot Tags:

PowerPivot import from multiple Identical Structure Excel Files

June 6th, 2011 1 comment

Often users want to import multiple identical Excel files into PowerPivot as one table. Unfortunately PowerPivot does not have native support for this.

The good thing is that there is a nice work around which someone else already blogged about. You can find out how to do it here: PowerPivot from Identical Structure Excel Files

What is new in PowerPivot for SQL Server Denali: sessions from Teched 2011

May 25th, 2011 2 comments

Last week I head the pleasure of attending TechEd North America in Atlanta, both presenting and meeting a lot of our customers. Teched was our great coming out party for the Analysis services Denali release. In this post you can find a lot of references to TechEd sessions and relevant blog posts.

The most important thing to come out of Atlanta is the updated vision and roadmap for the Analysis services team:
Watch the session here, this also includes a general overview of what is new for SSAS in Denali. The corresponding SSAS team blog post here and another interesting one from Chris Webb.

Other interesting sessions are:

 

And of course a awesome Crescent session:

 

Also make sure to check out the BI Power Hour: BI Power Hour which is always fun with demos of the latest technology. More detailed blog post will become available when Denali CTP3 becomes available.

If you want to know when CTP3 for SQL Server Denali (including PowerPivot and SSAS) will become available you can subscribe to a notification here.

 

 

Categories: Analysis services Tags: ,