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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mibu
Employee
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

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"

Thank you sir!  Appreciate it!  best, mibu

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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