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
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.

5 REPLIES 5
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 ,

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 wanna aggregate first and the 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
Post Prodigy
Post Prodigy

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.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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