This blog post is for people who have seen the reports built on PowerPivot model where the Month Names are not in correct logical order. So instead of “January, February, March, April …” (which is correct logical order), the order in the report would be displayed as “April, February, January, March..” (which is NOT correct).
This is what I am talking about:
Here, Month names are not sorted correctly, right? So how do we solve this? Let’s see this in this blog post!
Understanding the Sample Data-set
Optional: Download a sample data-set to practice what’s described in this blog-post: Download – Paras Doshi Blog’s sample data set
Now the data looks like this:
|Date||Daily New number||Month||Month Name|
Note that “Daily new number” is used for the demo purpose. I had to anonymize the data before I could share it with you all!
Originally, the table had just two columns but since I wanted to add “time Intelligence” to the model. I added two columns Month and Month Name.
Now here’s the DAX behind these two columns:
There’s a relationship between Month Column of “Sample Table” and Month column of “Month” table
And here’s what Month Table looks like:
Creating a Report on Top of Sample Data-set.
Now if you create the report of Month Name vs Daily New Number, it will look like:
Oops, Problem detected: Month name are not in correct order.
So now let’s solve it.
Solution to sort month name correctly
Let’s solve this issue in our PowerPivot Model. Here’s what you do:
1. Go to PowerPivot model, Select “Month Name” column from the sample table
2 Toolbar > Home > Sort By column > click on “Sort by column”
3. And set the properties in the dialog box as:
Now, go back to the report and refresh the connection to the model.
This is so because by default since the month name is “Text” – it was sorted in A to Z format. But you saw how we can use the sort by column property in PowerPivot model to fix this issue.
That’s about it for the post! your feedback is welcome!
Want to Read More? Here are few links:
- New Publication: Building Ideal PowerPivot Model for Power View reports [SolidQ Journal] (parasdoshi.com)
- Played with Microsoft research “Project Daytona” – MapReduce on Windows Azure (parasdoshi.com)
- Data Mining: Classification VS Clustering (cluster analysis) (parasdoshi.com)