Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
823 views
in Power BI by 23 25 39
In Power BI ,  I need to auto generate year range table start from 1900 to 2050 in Power Query Editor, How I can do that ?

1 Answer

0 like 0 dislike
by 23 25 39

Auto-generate year range table in Power Query Editor in Power BI

Steps

  1. From Query Editor > Home tab and select New source > Blank Query .
    Create blank query
  2. Enter the name of the list
    Write the name of list
  3. From the Home tab select Advanced Editor and paste the below code based on your year range.

      let
      Source = {1900..2050},
      #"ConvertToList1"={Source},
      #"ConvertToList2"=#"ConvertToList1"{0}
      in
      #"ConvertToList2"
    

    Write code that generates the year

  4. Great, the year table is created based on the specified range!
    years list
If you don’t ask, the answer is always NO!
...