I need a list of the past 5 years in a new table, so the column would have (2013 ... 2016, 2017). List.Dates seems like the perfect function for this except the duration functions that it requires only have intervals of days/hrs/minutes as far as I can tell. Any way of doing this by way of formula instead of manually?
Thanks
Pierre
Solved! Go to Solution.
Hi @pierre415,
Based on my test, you should also be able to use the formula(DAX) below to create a new calculate table to make an automated list of past 5 years that updates itself over the years.
Year = DISTINCT ( SELECTCOLUMNS ( CALENDAR ( DATE ( YEAR ( TODAY () ) - 4, 1, 1 ), TODAY () ), "Year", YEAR ( [Date] ) ) )
Regards
For something this straightforward, you can manually create a table. Simply click on "Enter Data" on the top ribbon of Power Bi and it will allow you to manually enter a small dataset like this.
If you want/need something fancier without getting into utilizing complex M functions (M is great but sometimes the heavy lifting is better off being done by the big boys such as Chris Webb instead of mere mortals like us), you can use the "New Table" functionality that is in Power BI. So for example, if the data you need for a look up table is contained within your fact table, you could create a dynamic table by using some of the "table" functions of DAX. So in this case, if all 5 years you need are con[tained in your fact table, you can simply do the following:
1. Select "modeling" tab
2. Select "New Table"
3. In formula bar, create new table with following syntax:
Year Table = ALL('FACT_TABLE_NAME'[YEAR])
That's it. If you want more details on the create table functionality, there's a great blog post by @MattAllington (whom you will see frequently posting on this forum and all around the web on the Microsoft BI Stack) on PowerPivotPro here: Table Function
Whew, that's a lot. I hope this helps. Good luck.
Thanks, I'm looking to make an automated list that updates itself over the years though
Hi @pierre415,
Based on my test, you should also be able to use the formula(DAX) below to create a new calculate table to make an automated list of past 5 years that updates itself over the years.
Year = DISTINCT ( SELECTCOLUMNS ( CALENDAR ( DATE ( YEAR ( TODAY () ) - 4, 1, 1 ), TODAY () ), "Year", YEAR ( [Date] ) ) )
Regards
That's awesome, thank you
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!
At the monthly call, connect with other leaders and find out how community makes your experience even better.
User | Count |
---|---|
402 | |
105 | |
68 | |
55 | |
49 |
User | Count |
---|---|
379 | |
118 | |
82 | |
67 | |
54 |