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

MAXX function throwing another column

Hello PowerBi,
 
I am trying to return a minimum and maximum date for each user following the sample code listed below.
=CALENDAR (MINX (Sales, [Date]), MAXX (Forecast, [Date]))
 
However, I keep recieving the following error. Why is my MAXX function throwing another column?
 
Error: The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
Code: Test_Column = CALENDAR(MINX('User_Xref', filter('User_Xref', [LastDt] <> blank())), MAXX('User_Xref', filter('User_Xref', [LastDt] <= today())))
1 ACCEPTED SOLUTION
Michiel
Resolver III
Resolver III

Your formula doesn't look too bad, but only as a calculated table which is what CALENDAR is meant for. 

 

I assume both your Sales table and your Forecast table have a [Date] column? First, the best practice is to put the table name before the column name in a formula, so

CALENDAR( MINX(Sales, Sales[Date]), MAXX(Forecast, Forecast[Date]))

 

In fact, this can be written in a simpler way by not using the table functions MINX and MAXX, but the basic aggregations:

CALENDAR(MIN(Sales[Date]), MAX(Forecast[Date]))

 

If the last line is the code you're trying to use, the problem there is that MINX expects a scalar value for each row in the table (User_Xref in your case) which is calculated through the expression you provide. This expression is:

FILTER(User_Xref, [LastDT] <> BLANK())

but FILTER returns a subset of the User_Xref table, which probably contains multiple columns. Poor MINX wouldn't know what to compare to what here (even if the table has one column, you would provide multiple rows which wouldn't work either)

View solution in original post

5 REPLIES 5
Michiel
Resolver III
Resolver III

Your formula doesn't look too bad, but only as a calculated table which is what CALENDAR is meant for. 

 

I assume both your Sales table and your Forecast table have a [Date] column? First, the best practice is to put the table name before the column name in a formula, so

CALENDAR( MINX(Sales, Sales[Date]), MAXX(Forecast, Forecast[Date]))

 

In fact, this can be written in a simpler way by not using the table functions MINX and MAXX, but the basic aggregations:

CALENDAR(MIN(Sales[Date]), MAX(Forecast[Date]))

 

If the last line is the code you're trying to use, the problem there is that MINX expects a scalar value for each row in the table (User_Xref in your case) which is calculated through the expression you provide. This expression is:

FILTER(User_Xref, [LastDT] <> BLANK())

but FILTER returns a subset of the User_Xref table, which probably contains multiple columns. Poor MINX wouldn't know what to compare to what here (even if the table has one column, you would provide multiple rows which wouldn't work either)

Unity
Frequent Visitor

Using this code

 

CALENDAR(MIN(Sales[Date]), MAX(Forecast[Date]))

 

is closer but now results in this error:

 

A table of multiple values was supplied where a single value was expected.

Your code starting with 'Test_Column =' suggests that you're trying to create a calculated column, for which the formula should always return a scalar value. CALENDAR returns a table.

Tough to say, something wonky with your data? Not actual date fields? I recreated this and had no issues. See attached, Sales, Forecast and Table.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Community Champion
Community Champion

Weird, I'd try CALENDARAUTO()



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.