I have a measure to determine how many invoices are arriving late to our AP offices.
However, this measure returns 100% - the numerator and denominator are the same. For a given department, 17 of 46 invoices were delivered after 15 days, but the AllVouchers variable is coming in at 17.
If I use a separate measure for the invoice count
and then adjust the first measure to use that measure as the denominator
I get the correct result. Anyone have a clue why I'm getting it wrong with the first option?
VBA Code:
Pct of Invoices Recvd in AP >14 Days:=
VAR IsLate = 15
VAR LateVouchers =
CALCULATE (
DISTINCTCOUNT ( Vouchers[Invoice_Key] ),
Vouchers[Invoice to Entry Days] >= IsLate
)
VAR AllVouchers =
DISTINCTCOUNT(Vouchers[Invoice_Key])
VAR Ratio =
CALCULATE (
DIVIDE (
LateVouchers,
AllVouchers
),
USERELATIONSHIP ( Vouchers[Account], 'Account Tree'[Account] ),
USERELATIONSHIP ( Vouchers[Dept ID], '3PL Cost Centers'[Center] ),
USERELATIONSHIP ( Vouchers[Dept ID], Depts[Dept] ),
USERELATIONSHIP ( Vouchers[Voucher Entered Date], AP_Calendar[Date] )
)
RETURN
Ratio
If I use a separate measure for the invoice count
VBA Code:
Invoice Count:=CALCULATE(
DISTINCTCOUNT(Vouchers[Invoice_Key]),
USERELATIONSHIP ( Vouchers[Account], 'Account Tree'[Account] ),
USERELATIONSHIP ( Vouchers[Dept ID], '3PL Cost Centers'[Center] ),
USERELATIONSHIP ( Vouchers[Dept ID], Depts[Dept] ),
USERELATIONSHIP ( Vouchers[Voucher Entered Date], 'AP_Calendar'[Date] )
)
VBA Code:
Pct of Invoices Recvd in AP >14 Days:=
VAR IsLate = 15
VAR LateVouchers =
CALCULATE (
DISTINCTCOUNT ( Vouchers[Invoice_Key] ),
Vouchers[Invoice to Entry Days] >= IsLate
)
VAR Ratio =
CALCULATE (
DIVIDE (
LateVouchers,
[Invoice Count]
),
USERELATIONSHIP ( Vouchers[Account], 'Account Tree'[Account] ),
USERELATIONSHIP ( Vouchers[Dept ID], '3PL Cost Centers'[Center] ),
USERELATIONSHIP ( Vouchers[Dept ID], Depts[Dept] ),
USERELATIONSHIP ( Vouchers[Voucher Entered Date], AP_Calendar[Date] )
)
RETURN
Ratio