Error type IF()

Hey Heplers,

Need some help on something please.

 

 

SUM(
  IF(
    MONTH([Date]) = MONTH(TODAY()),
    SELECT(Type[Amount], [Type] = [_THISROW].[Type]) - SELECT(Tracker[Amount], [Type] = [_THISROW].[Type]),
    0,00
  )
)

 

 

My code looks ok to be but am getting the following error:

 

 

IF function is used incorrectly:the second input (if-result) and third input(else-result) should have the same type.

 

 

The Amount type is Price.

Thanks again

0 1 52
1 REPLY 1

So Select(... is producing a list type rusult where "0,00" is being interpreted as either text or a decimal.  I presume you want the later, so change it to

SUM(
  IF(
    MONTH([Date]) = MONTH(TODAY()),
    SELECT(Type[Amount], [Type] = [_THISROW].[Type]) - SELECT(Tracker[Amount], [Type] = [_THISROW].[Type]),
    LIST(0.00)
  )
)

Though this would look more logical and legible

IF(
MONTH([Date]) = MONTH(TODAY()),
SUM(SELECT(Type[Amount], [Type] = [_THISROW].[Type])) - SUM(SELECT(Tracker[Amount], [Type] = [_THISROW].[Type])),
0
)

Simon, 1minManager.com

Top Labels in this Space