0

Format Number for week

I have week number which is displayed as 1, 2.. What function can I use to display it as 01, 02..

2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • hi Snehal Nandagawli there is not a built-in function but you can use existing functions and logic to craft your own function to pad zeroes. See this post for a couple of different examples. If you are leveraging the week number from a table (like our Date Dimension example) you can consider adding this as a formula column on the physical schema rather than calculating at runtime. 

    Like
    • Dustin Basil thank you, I was able to make it work :)

      if(
                  length(
                      string(
                          WEEK_NBR
                      )
                  ) < 2, 
                  concat(
                      '0', 
                      string(
                          WEEK_NBR
                      )
                  ), 
                  string(
                      WEEK_NBR
                  )
              )

      Like
Like Follow
  • 12 days agoLast active
  • 2Replies
  • 28Views
  • 2 Following

Product Announcement

Incorta 5 is now Generally Available