1
- Open the PowerBI Desktop App.
- Once you’ve launched the PowerBI and loaded the tables into it, prepare your data by clicking the second icon on the left bar.
2
Choose which table you want to prepare the data. To do this choose any of the objects from the table on the right. For illustration purposes, the quote table was selected.
Note: The data used in this example are sample data.
3
Choose which column needs to be prepared. In this example, the quote date was chosen as this column is in date and time format, which will not format well to a graph.
4
To prepare the data in a usable format, click the New column option to create a new column and transfer only the years into this column.
5
From the Column Tools tab, rename the column name to something meaningful. In this case, the column is renamed as Year.
6
Use the = sign and apply the formula to define the outcome from this column. In this example, the desire is to extract the year from the date and time on the quotedate under the quote table. To do this the DAX function mid applied, which gets the mid of the string. In this case, the outcome is to get the 1st character and then the next 4 including the 1st, so the code will look like year = mid((Table_name[Column_Name]), 1, 4)
7
In this example, the coding applied was year = mid((quote[quotedate]), 1, 4)
and the programming language being used is called DAX.
To learn more, click on the link DAX Functions Tutorial.
8
To create another column for the months, refer to Step 4 by pressing the New Column option and name it as month. Modify the code from the year column and change it to fit the month. month = mid((quote[quotedate]), 6, 2).
From this coding the 6 will make it start at the 6th character and the 2 will take two including the 6th.
9
You can use this same process to prepare any data.