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
Flichaster
Frequent Visitor

New DAX User: Defining a new measure by removing date filter, leads to syntax error

NewtoDax =
VAR NEW_OverallStartDate = [NEW_OverallStartDate]
VAR StartDate =
CALCULATE(
    MIN('Everything Clarity, Project without totals'[Start Date]),
    REMOVEFILTERS('Start Date')
)
 
I really dont understand where my mistake it. I receive the following error:
Flichaster_0-1667841673788.png

Thanks

2 ACCEPTED SOLUTIONS
KNP
Super User
Super User

Add 'RETURN StartDate' on the end.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

View solution in original post

The alternative to this would be...

Replace 'VAR StartDate = ' with 'RETURN'

I prefer the VAR option for readability though.

 

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

View solution in original post

6 REPLIES 6
KNP
Super User
Super User

Add 'RETURN StartDate' on the end.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

KNP,

Feels like DAX is a mix of most progamming tool. Similiar to return in
R-studio/Python. Thanks much. This helped lots. 

 

The alternative to this would be...

Replace 'VAR StartDate = ' with 'RETURN'

I prefer the VAR option for readability though.

 

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

Ahh Got it. Totally agree with you on that. Thanks Again.

Greg_Deckler
Super User
Super User

@Flichaster Try:

NewtoDax =
VAR NEW_OverallStartDate = [NEW_OverallStartDate]
VAR StartDate =
CALCULATE(
    MIN('Everything Clarity, Project without totals'[Start Date]),
    REMOVEFILTERS('Everything Clarity, Project without totals'[Start Date])
)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

I still get the same error.

Flichaster_0-1667842641850.png

My start date follows a Date Hierarchy, My initial Picture with removefilters('StartDate') is a new table that does not follow Date Hierarchy

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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