Forum Discussion
How to create query using data from existing tables in Power Query Editor
Hi,
Create a Calendar table and build a relationship from the Date column of each of the 5 different tables to the Date column of the Calendar Table. In the Calendar Table, write these calculated column formula to extract Year and Month
Year=Year(Calendar[Date])
Month=FORMAT(Calendar[Date],"mmmm")
Create another 12 rows by 2 column table with Month names mentioned in range A2:A13 and numbers (in descending order from 12 to 1) in range B2:B13 (This Table is named Month_Order and the column headings are Month and Order). Create a relationship from the Months column of the Calendar Table to the Month column of this Table. In the Calendar Table, write this calculated column formula
=RELATED(Month_Order[Order])
Now click on any cell in the Month column of the Calendar Table and under Sort By column, select Order.
Build your Matrix visual by dragging Year and Month from the Calendar Table to the Column headers. Write measures to get the figures.
Hope this helps.
Hi Ashish,
Would I create the calendar table using Dax or do I create this as a query editor?
Thank you too for your response.
Regards,
Angela
- Ashish_Mathur7 years ago
Super User
Hi,
Click on New Table and write this formula
Calendar=CALENDER(DATE(2017,1,1),DATE(2018,12,31))
- Angela_Rom7 years ago
Helper I
Hi Ashish,
Thank you for your response. I tried the calendar table as suggested but this view is limited to the dates provided in the formula. I need the dates to show a 12 month view at all times and be able to change each month as the months change. I think I have to create this in Power Editor query by establishing a date table in the query and merging the data with the date table. Do you know anyway to create a date table as a query?
- Ashish_Mathur7 years ago
Super User
Hi,
This only creates the Calendar Table. What you wan should be written as a DAX expression. Share more information to get more specific help.