Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
mibu
Microsoft Employee
Microsoft Employee

Entering DAX on multiple lines when creating a new table with DAX

Team,

 

I am trying to create a Date table with DAX as follows:

1 Date = 

2 ADDCOLUMNS (

3         CALENDARAUTO(),

4         "Year", YEAR ( [Date] )

5 )

 

But I seem to be able to only enter the code on a single line as follows:

Date = ADDCOLUMNS ( CALENDARAUTO(), "Year", YEAR ( [Date] ) )
 
Each time I put the cursor, say for example after = and hit Return...  to give myself a new line...  it just runs what DAX code is there.
 
Pls advise how I can code on multiple lines within...  Data...  Table tools...  New Table icon... 
 
Thank you!
mibu
1 ACCEPTED SOLUTION

@mibu make sure to hold down the SHIFT button if you want to go to another line 🙂


When typing measures / calculated columns / tables, you need to hold down the SHIFT and then hit ENTER to go to a new line. 

 

Hope that helps 🙂

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

5 REPLIES 5
TheoC
Super User
Super User

Hi  @mibu 

If you go here: https://dax.guide/calendarauto/

 

I believe you are not putting the comma , at the end to show that another column needs to be added.

1 Date = 

2 ADDCOLUMNS (

3         CALENDARAUTO () ,

4         "Year", YEAR ( [Date] ) , // The comma here to the left needs to be added then you can add more columns

5 )

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

mibu
Microsoft Employee
Microsoft Employee

Hey Theo, thanks for the link...  very helpful.

My issue though...  is that when I enter DAX I seem only to be able to do it on a single line...  rather than being able to enter on multiple lines...  by hitting Return after each entry...  do you know how I can get Power BI Desktop to allow me to code on multiple lines...  instead of on a single line...

 

Attached is what it looks likeOnly able to code on a single line in Power BI DesktopOnly able to code on a single line in Power BI Desktop

@mibu make sure to hold down the SHIFT button if you want to go to another line 🙂


When typing measures / calculated columns / tables, you need to hold down the SHIFT and then hit ENTER to go to a new line. 

 

Hope that helps 🙂

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Thanks @TheoC ... so easy yet so "hidden"

mibu
Microsoft Employee
Microsoft Employee

Thank you sir!  Appreciate it!  best, mibu

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.