Forum Discussion
Date Table Creation Queries
Hi community.
I am creating a Date Table that I do not require to always input the columns but one stack of code. As I was creating it, I had a problem which was referencing other columns in a new column.
It became quite hard to use quoted columns above in the same code.
The pbix with the Date table with the errors is here. Thanks.
Date pbix file
Hi, Anonymous
I checked your code, and saw you use 'addcoumn' function to create your date table, you should know that the new columns are side by side, so you can’t refer to one column from another.
You have two ways, one is to use addcolumn nested, so that the following columns can refer to the column names in the previous table.
The second is to create a new column in the form of a calculated column.
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
Best Regards,Community Support Team _ Janey
- Anonymous4 years ago
THis is awesome v-janeyg-msft .
4 Replies
- v-janeyg-msftCommunity Support
Hi, Anonymous
I checked your code, and saw you use 'addcoumn' function to create your date table, you should know that the new columns are side by side, so you can’t refer to one column from another.
You have two ways, one is to use addcolumn nested, so that the following columns can refer to the column names in the previous table.
The second is to create a new column in the form of a calculated column.
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
Best Regards,Community Support Team _ Janey
- AnonymousNot applicable
THis is awesome v-janeyg-msft .
- amitchandakSuper User
Anonymous , Date is the only column you have available for add columns to use. All your calculation should be based on that.
Not very clear what you want to do there, But have the same var there in other columns and try.
example
"Day",VAR Current_Year = RIGHT(YEAR([Date]),2) VAR Last_Year = RIGHT(YEAR([Date])-1,2) VAR Next_Year = RIGHT(YEAR([Date])+1,2) VAR Fiscal_Year = IF( MONTH([Date]) >= 4, Current_Year & "/" & Next_Year, Last_Year & "/" & Current_Year ) RETURN FORMAT ( [Date], CONCATENATE("dd-ddd-mmm ", Fiscal_Year)),- AnonymousNot applicable
amitchandak What I am trying was to use already quoted columns to create other columns but I guess from your comment, that is impossible and one can only use the Date Column in reference to creating other columns, right?