0
votes

I am trying to do this expression but this shows an error:

vMotor_Paid =
CALCULATE (
    Paid_excel,
    SUM ( Paid_excel[PAID_AMOUNT] ),
    Paid_excel[Flag] = "Paid",
    Premium_Excel[LOB] = "MOTOR",
    Paid_excel[PAID_DATE] = { [VpeDate] }
)

Error: A function 'SUM' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

In the expression, I am trying to do SUM of paid_amount against filters of these

Paid_excel[Flag]="Paid",
Premium_Excel[LOB]="MOTOR",
Paid_excel[PAID_DATE]={[VpeDate]}

Here I create another variable of VPeDate where I fixed the date "23-12-2017"

Any help?

2

2 Answers

1
votes

I don't understand why your date is wrapped in curly braces. I think you might have more luck like this:

vMotor_Paid =
VAR VpeDate = [VpeDate]
RETURN
CALCULATE (
    SUM ( Paid_excel[PAID_AMOUNT] ),
    Paid_excel[Flag] = "Paid",
    Premium_Excel[LOB] = "MOTOR",
    Paid_excel[PAID_DATE] = VpeDate
)

Now that CALCULATE filter is comparing versus a date rather than an expression that returns a date.

0
votes
vMotor_Paid = CALCULATE(SUM(Paid_excel[PAID_AMOUNT]),FILTER(Paid_excel[Flag]="Paid"
,Premium_Excel[LOB]="MOTOR",Paid_excel[PAID_DATE]={[VpeDate]}))

Please check the calculate syntax