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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
SuzieKidd
Frequent Visitor

DAX Measure Query

Hello, 

Does anyone know why I get an error when I use this in a measure:

VAR __fyStart = DATE(YEAR(Calendar_Lookup[Date]), 4, 1)
VAR __fyEnd = DATE(YEAR(Calendar_Lookup[Date]) + 1, 3, 31)

 

Error message : A single value for column 'Date' in table 'Calendar_Lookup' cannot be determined. This can happen when a measure or function formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

 

I'm trying to create a measure to calculate the total cost per financial year considering the days.

 

Thank you.

2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

Try

VAR MaxDate = MAX(Calendar_Lookup[Date])
VAR __fyStart = DATE(YEAR(MaxDate), 4, 1)
VAR __fyEnd = DATE(YEAR(MaxDate) + 1, 3, 31)

That will use the latest date from the filter context.

View solution in original post

v-sdhruv
Community Support
Community Support

Hi @SuzieKidd ,

As correctly pointed by the users, you do not have an active row context on the Calendar_Lookup Table, therefore you get the error.Since you're referencing Calendar_Lookup[Date] directly in a measure without an aggregation, it throws you this error. Measures operate in a filter context, and if that context includes multiple rows, DAX doesn't know which single value to use unless you specify it.

Maybe you want to aggregate first and then use it-

VAR __fyStart = DATE(YEAR(MAX(Calendar_Lookup[Date])), 4, 1)
VAR __fyEnd = DATE(YEAR(MAX(Calendar_Lookup[Date])) + 1, 3, 31)


Hope this helps!

View solution in original post

7 REPLIES 7
v-sdhruv
Community Support
Community Support

Hi @SuzieKidd ,

Just wanted to check if you had the opportunity to review the suggestions provided?
If you still face any issues feel free to reach out.
Thank You

v-sdhruv
Community Support
Community Support

Hi @SuzieKidd ,

Just wanted to check if you had the opportunity to review the suggestions provided?
Thank You

v-sdhruv
Community Support
Community Support

Hi @SuzieKidd ,

Just wanted to check if you had the opportunity to review the suggestions provided?
If any of the response has addressed your query, please accept it as a solution so that other members can easily find it.
Thank You

v-sdhruv
Community Support
Community Support

Hi @SuzieKidd ,

As correctly pointed by the users, you do not have an active row context on the Calendar_Lookup Table, therefore you get the error.Since you're referencing Calendar_Lookup[Date] directly in a measure without an aggregation, it throws you this error. Measures operate in a filter context, and if that context includes multiple rows, DAX doesn't know which single value to use unless you specify it.

Maybe you want to aggregate first and then use it-

VAR __fyStart = DATE(YEAR(MAX(Calendar_Lookup[Date])), 4, 1)
VAR __fyEnd = DATE(YEAR(MAX(Calendar_Lookup[Date])) + 1, 3, 31)


Hope this helps!

FBergamaschi
Solution Sage
Solution Sage

The reason is that you do not have an active row context on the Calendar_Lookup Table, since a measure does not create a row context on a table, unless you explicit ask so. So you can find the code to use in a measure in the preceding pst by another supporter in the forum, but here is the reason that you were asking for

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

johnt75
Super User
Super User

Try

VAR MaxDate = MAX(Calendar_Lookup[Date])
VAR __fyStart = DATE(YEAR(MaxDate), 4, 1)
VAR __fyEnd = DATE(YEAR(MaxDate) + 1, 3, 31)

That will use the latest date from the filter context.

Thank you for all the responses, I have now resolved this issue.

Suzie

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.