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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
samdep
Advocate II
Advocate II

Table of Multiple Values Supplied Error

Hi Community - I am getting an error with the below DAX - specifically "A table of multiple values was supplied where a single value was expected" and I've been reading about the meaning of this error, but am unsure how to resolve in my specific case. Is there anything glaring that I am overlooking? Any thoughts would be much appreciated. 

The sample table below shows my data - and 'New Column' is my goal.
 
Previous Amount =
IF(
   OR(Opportunity[StageName] = "Closed Lost", Opportunity[Recurring__c] = FALSE()), BLANK(),
          LOOKUPVALUE(Opportunity[Amount], Opportunity[CloseDate],
                 CALCULATE(MAX(Opportunity[CloseDate]),
                      FILTER(Opportunity, Opportunity[AccountId] = EARLIER(Opportunity[AccountId])
                     && Opportunity[CloseDate]EARLIER(Opportunity[CloseDate])
                     && Opportunity[StageName] = "Closed Won"
                     && Opportunity[Recurring__c] = TRUE())),
                     Opportunity[AccountId], Opportunity[AccountId], Opportunity[Recurring__c], TRUE())
)
 
Many Thanks!
 
AccountIdAmountStageRecurringCloseDateNew Column
A$10Closed WonTrue2/1/22$5 - Previous Value (1/1/22)
B$5Closed WonFalse2/11/22blank -as not recurring and no prior value
A$5Closed WonTrue1/1/22$5 - Previous Value (12/1/21)
C$50Closed LostTrue2/1/22blank - while recurring, stage is closed lost.
C$100Closed WonTrue1/1/22blank - no prior value
A$5Closed WonTrue12/1/22blank - no prior value
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@samdep , Try like

 


New column =
var _max = CALCULATE(MAX(Opportunity[CloseDate]),
FILTER(Opportunity, Opportunity[AccountId] = EARLIER(Opportunity[AccountId])
&& Opportunity[CloseDate] = EARLIER(Opportunity[CloseDate])
&& Opportunity[StageName] = "Closed Won"
&& Opportunity[Recurring__c] = TRUE()))

return
CALCULATE(Sum(Opportunity[Amount]),
FILTER(Opportunity, Opportunity[AccountId] = EARLIER(Opportunity[AccountId])
&& Opportunity[CloseDate] = _max
&& Opportunity[StageName] = "Closed Won"
&& Opportunity[Recurring__c] = TRUE()))

View solution in original post

2 REPLIES 2
samdep
Advocate II
Advocate II

Thank you so much! This works perfectly!!

amitchandak
Super User
Super User

@samdep , Try like

 


New column =
var _max = CALCULATE(MAX(Opportunity[CloseDate]),
FILTER(Opportunity, Opportunity[AccountId] = EARLIER(Opportunity[AccountId])
&& Opportunity[CloseDate] = EARLIER(Opportunity[CloseDate])
&& Opportunity[StageName] = "Closed Won"
&& Opportunity[Recurring__c] = TRUE()))

return
CALCULATE(Sum(Opportunity[Amount]),
FILTER(Opportunity, Opportunity[AccountId] = EARLIER(Opportunity[AccountId])
&& Opportunity[CloseDate] = _max
&& Opportunity[StageName] = "Closed Won"
&& Opportunity[Recurring__c] = TRUE()))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors