Tag Archives: Power BI

ByHariharan Rajendran

Power BI Report Server

Microsoft SQL Server Reporting Services is the product which provides solutions to all the business enterprises. While it was in peak, Microsoft released another new BI tool which is nothing but Power BI.

Now Power BI is leading the Business Intelligence Industry. As it is a cloud-based service, business users were not able to use that tool for their business solutions because of security concerns. They were waiting for on-premises based Power BI server.

Now the wait is over. Microsoft released Power BI Report server which can be installed and configured for on-premises business solutions.

Power BI Report server is available for preview, you can download, install and experience the on-premises based Power BI Report.

As it is very new, it supports only analysis services as a source but in future, we can expect the same source connectors as like in Power BI cloud services.

This blog post explains to you that how you can experience the Power BI Report server using the Azure VM template.

Follow the below steps to spindle up Azure VM with Power BI Report Server on it.

Step 1: Login Azure portal and add a new Virtual machine

Step 2: Search for Power BI and it will show the below template

Step 3: Click create

Step 4: Add the VM name and credentials and choose which AS server you want to use from the drop down.

Step 5: By default, it using the below settings. In case, if you get an error message then change the name of the storage.

Step 6: At last, you need to click the purchase button. It will create and deploy the Power BI machine.Once the machine is deployed successfully, connect the machine and you can see the Power BI.

Once the machine is deployed successfully, connect the machine and you can see the Power BI Report Server.It also adds an option to create Power BI Report from the portal itself.

ByHariharan Rajendran

Date Table in Power BI – M Language

Power BI Desktop supports Power Query Language which is nothing but M language for data modeling.

This article explains how we can create date table with all the necessary columns. Generating date table is easy in Power BI as we have different methods.

Refer my below article to generate date table manually or with single DAX query.

Date table in Power BI

Use the below M query to create a date table,

//Create Date Dimension

(StartDate as date, EndDate as date)=>


    //Capture the date range from the parameters

    StartDate = #date(Date.Year(StartDate), Date.Month(StartDate),


    EndDate = #date(Date.Year(EndDate), Date.Month(EndDate),


//Get the number of dates that will be required for the table

    GetDateCount = Duration.Days(EndDate – StartDate),

//Take the count of dates and turn it into a list of dates

    GetDateList = List.Dates(StartDate, GetDateCount,


//Convert the list into a table

    DateListToTable = Table.FromList(GetDateList,

    Splitter.SplitByNothing(), {“Date”}, null, ExtraValues.Error),

//Create various date attributes from the date column

    //Add Year Column

    YearNumber = Table.AddColumn(DateListToTable, “Year”,

    each Date.Year([Date])),

//Add Quarter Column

    QuarterNumber = Table.AddColumn(YearNumber , “Quarter”,

    each “Q” & Number.ToText(Date.QuarterOfYear([Date]))),

//Add Week Number Column

    WeekNumber= Table.AddColumn(QuarterNumber , “Week Number”,

    each Date.WeekOfYear([Date])),

//Add Month Number Column

    MonthNumber = Table.AddColumn(WeekNumber, “Month Number”,

    each Date.Month([Date])),

//Add Month Name Column

    MonthName = Table.AddColumn(MonthNumber , “Month”,

    each Date.ToText([Date],”MMMM”)),

//Add Day of Week Column

    DayOfWeek = Table.AddColumn(MonthName , “Day of Week”,

    each Date.ToText([Date],”dddd”))




It asks for start and end date. Once entered the date then click Invoke, it will generate the query.

ByHariharan Rajendran

DAX Leap Year In Power BI

Identifying the Leap is very simple logic, this post explains that how you can identify a year which is a leap year or non-leap year in Power BI.

Consider I have a year column on my table. If not then use the Year function on the data column and get the year column.

You need to find the below values,

  1. Year Start Date
  2. Year End Date
  3. Days between Year Start Date and Year End Date.
  4. Check the number of days

That’s it, very simple.

Use the below DAX expressions to identify the above values.

YearStartDate = DATE(‘Year'[Year],01,01)

YearEndDate = DATE(‘Year'[Year],12,31)

TotalDays = (‘Year'[YearEndDate]-‘Year'[YearStartDate])*1+1

IsLeapyear = IF(‘Year'[TotalDays]=366,”Yes”,”No”)

Happy Learning.

ByHariharan Rajendran

Power BI Pre-defined Transformations

This article talks about the pre-defined transformations that we can directly use in Power BI Desktop. These transformations are part of Power Query Editor.

As a business intelligence developer, usually we spend most of the time to prepare the dataset for report and dashboards. Preparing the dataset includes, getting the data from different sources, data modelling and transform the data.

Data transform is applicable for both rows and columns. Check the list of pre-defined transforms in Power BI Desktop.

These transforms are grouped into different categories.

Table Level

To add a new column

To play with the columns,

To format a text column,

To format a number column,

Date and Time columns,

The above sections are specific to columns. To play with rows,

There any many situations where we need to combine the tables and queries. To handle those scenarios, we can use the below options in Power BI.

To sort the columns,

We also have R script which we can use to perform any complex transform or logics with the data.

Apart from the pre-defined options still we can do complex logics with M language (Power Query Language).

Happy Learning & Share your comments.

ByHariharan Rajendran

Date table in Power BI

Every BI Solutions will have a date dimension table data with other business data. Date dimension is one of the mandatory table as most of the analysis are based on date dimension table.

We can generate the date dimension table in all the scenarios. This post explains you that how we can generate the date dimension table in Power BI.

We have different ways to generate date dimension table. Here I explained two different ways.

Create a table by creating individual column manually

Use New table option and start to create the columns with below expressions.

Column Name Expressions
DateAsInteger FORMAT ( [Date], “YYYYMMDD” )
Year YEAR ( [Date] )
Quarter “Q” & FORMAT ( [Date], “Q” )
YearQuarter FORMAT ( [Date], “YYYY” ) & “-Q”

& FORMAT ( [Date], “q” )

Monthnumber FORMAT ( [Date], “MM” )
YearMonthnumber FORMAT ( [Date], “YYYY/MM” )
YearMonthShort FORMAT ( [Date], “YYYY/mmm” )
MonthNameShort FORMAT ( [Date], “mmm” )
MonthNameLong FORMAT ( [Date], “mmmm” )
DayOfWeekNumber WEEKDAY ( [Date] )
DayOfWeek FORMAT ( [Date], “dddd” )
DayOfWeekShort FORMAT ( [Date], “dddd” )

Single Script to Generate Date Table

Add the below script in New table expression.

DimDate =

VAR fiscal_year_end_month = 3



        CALENDARAUTO ( fiscal_year_end_month ),

        “DateAsInteger”, FORMAT ( [Date], “YYYYMMDD” ),

        “Year”, YEAR ( [Date] ),

        “Quarter”, “Q” & FORMAT ( [Date], “Q” ),

         “YearQuarter”, FORMAT ( [Date], “YYYY” ) & “-Q”

            & FORMAT ( [Date], “q” ),

        “Monthnumber”, FORMAT ( [Date], “MM” ),

        “YearMonthnumber”, FORMAT ( [Date], “YYYY/MM” ),

        “YearMonthShort”, FORMAT ( [Date], “YYYY/mmm” ),

        “MonthNameShort”, FORMAT ( [Date], “mmm” ),

        “MonthNameLong”, FORMAT ( [Date], “mmmm” ),

        “DayOfWeekNumber”, WEEKDAY ( [Date] ),

        “DayOfWeek”, FORMAT ( [Date], “dddd” ),

        “DayOfWeekShort”, FORMAT ( [Date], “dddd” )


The above script will generate a table with all the columns. We can customise the table by modifying the expression.

ByHariharan Rajendran


In Power BI, you can use the pre-defined function CALENDARAUTO() to create date table with a column called “Date”. It will generate a date for current 1 year by default.

This above function will only work when you have a model with at least one column with date or datetime data type.

In the below screenshot, I tried to use CALENDARAUTO() function in an empty model.

You can see the warning message above.

“CALENDARAUTO() function can not find a base column of DateTime type in the model”

In the same scenario, I just added a simple table with one date data type column then I used the CALENDARAUTO() in a new table and this time I got the expected result.

Happy Learning. Share your comments.

ByHariharan Rajendran

SharePoint List to Power BI & Extending Power BI to SharePoint

This article explains to you that how we can use SharePoint list as a source for Power BI and also extending the Power BI report to embed on SharePoint.

I am following the same strategy in all my blogs. Reading a big paragraph is tough than a step by step points as it is easy to follow and remember.



  1. SharePoint List URL
  2. SharePoint Credentials (On-premises or O365)
  3. Power BI Account
  4. Power BI Desktop

Follow the below steps,

Step 1: Create a SharePoint list as per your business needs. It can be simple or complex with calculated columns. In my case, I created a simple SharePoint list with some sample content as like below.

Step 2: Get the SharePoint URL where the list is created.


Step 3: Open Power BI Desktop and click Get Data.

Step 4: Choose SharePoint Online List, if you use O365. Click Connect

Step 5: Pass the O365 SharePoint URL and credentials.

Step 6: Choose the list and click Load.

Step 7: It will load all the columns from the SharePoint list. Choose the visualization and map with the respective fields.

Step 8: Save and publish the report to Power BI online services

Step 9: Login to app.powerbi.com with your credentials.

Step 10: Open your report from your workspace where you published.

Embed the Report in SharePoint

So far, we created a report using SharePoint list. Now we are going to embed the report in SharePoint.

Follow the below steps.

Step 1: Open the report in app.powerbi.com

Step 2: If we have O365 E series license then we can use “Embed in SharePoint Online (preview)” option otherwise choose the below option.

Step 3: It will ask you to publish.

Step 4: Finally, it will generate URL and iframe code to place on any web page of SharePoint.

Step 5: Go to SharePoint page and edit where you want to embed this report.

Step 6: Click Insert and choose the Embed Code

Step 7: Copy and paste the iframe

Step 8: Save the page.

Share your comments below.

Related Post:

Embed Power BI Report in Web page

ByHariharan Rajendran

Embed Power BI Report in Web page

This article explains that how can we show your Power BI report to everyone.

We have variety options in app.powerbi.com for the specific report.

The notable options are,

Publish to Web

Embed in SharePoint Online (preview)

Export to PowerPoint (preview)

Let us discuss “Publish to Web” Option

Open your Power BI report and click File option. You can see the options as like below.

Choose “Publish to Web” and click “Create embed Code”

Then click “Publish”, it will create a code for us.

We can share the link to anyone or else can embed the iframe in any web page or in SharePoint.

Check the report,


Sachin Tendulkar’s Cricket Data – Embedded Report