2023年5月29日星期一

How to Create a Date Table in Power BI

 Here are the steps to create a Date table in Power BI:


1. In Power BI Desktop, click the "Modeling" tab and select "New Table".


2. Name the new table "Date". Chuwi herobook pro


3. In the Date column, click in the first cell and enter a start date. I'll use 1/1/2020.  


4. Hold Shift and click the last cell you want to fill. This will select the full range.    


5. Click the "Fill" button on the formula bar.    


6. In the "Series" dialog box:


- Select "Date" in the Category

- Set Column Input to 1/1/2020       

- Select "Day" in the Step

- Set Number of Iterations to the amount of dates you need

- Click "OK"


7. Two new columns will automatically be created: Month and Year.


8. You can add more calculated columns for:


- Quarter: =INT(([Month]-1)/3)+1   

- Day of Week: =DAY([Date])

- Week Number: =ISOWEEKNUM([Date])


9. Change the column data types:


- Date: Date       

- Month: Whole Number

- Year: Whole Number


10. Mark all date columns as a Date Hierarchy by right-clicking and selecting "Date Hierarchy".


11. The Date table is now ready to be relationships to other tables using the Date column.


This allows you to easily create visualizations sorted and filtered by date in Power BI. Let me know if you have any other questions!

没有评论:

发表评论

注意:只有此博客的成员才能发布评论。

Also Read: