I cannot figure out why my value (from expression) is wrong

I have a table that gives/shows Accounts receivable (AR). In my app i show AR based on day ranges:

0 -30
31 - 60
61 -90
90+

I am trying to now get the total PER day range and show that.

I used this expression:
SUM(select(AR[90 + Days Virtual], [Customer Number] = [_THIS].[Customer Number]))

This is [90 + Days Virtual]:
IFS(
(TODAY() > ([Document Date] + 90)),
[Current Trx Amount]
)

Here is what the expression gives me in my app:

If you manually calculate this it is wrong. I am not sure why.

I must note I filter this slice taking out:

โ€œCredit Memosโ€ and โ€œPaymentsโ€

AND( [Document Type] <> โ€œPaymentsโ€, [Document Type] <> โ€œCredit Memosโ€)

I looked at the raw data - and no where in โ€œPaymentsโ€ nor โ€œCredit Memosโ€ is there a value that would match the difference. Meaning I believe the slice filter is working correctly by taking out โ€œPaymentsโ€ and โ€œCredit Memosโ€.

Solved Solved
0 26 382
1 ACCEPTED SOLUTION

So, that is why I asked my very first question. You are using a slice view the filters out Payments and Credit Memos from the table AR. But your expressions themselves operate on the ENTIRETY of the AR table. Slices donโ€™t change the way expressions work on the underlying data.

SUM(
    SELECT(AR[90 + Days Virtual], 
        AND([Customer Number] = [_THIS].[Customer Number],
            [Document Type] <> โ€œPaymentsโ€,
            [Document Type] <> โ€œCredit Memosโ€
        )
    )
)

View solution in original post

26 REPLIES 26
Top Labels in this Space