Forum Discussion
Using DATESBETWEEN with relative date ranges
- 6 years ago
Hi,
You should have a Calendar Table with a relationship to the invoice date column. To your visual, drag Date from the Calendar Table. Write this measure
30-59 OVERDUE Balances = CALCULATE(SUM('ACCOUNTS_PAYABLE'[INVOICE_AMOUNT]),ACCOUNTS_PAYABLE[Unpaid?] in {"Unpaid"},DATESBETWEEN(Calendar[DATE], TODAY()-59, TODAY()-30) )Hope this helps.
cprine , Seem fine.
Try like
30-59 OVERDUE Balances =
var _min = TODAY()-59
var _max - TODAY()-30
return
CALCULATE (
SUM('ACCOUNTS_PAYABLE'[INVOICE_AMOUNT]),
filter(ACCOUNTS_PAYABLE, ACCOUNTS_PAYABLE[Unpaid?] in {"Unpaid"} && ACCOUNTS_PAYABLE[INVOICE_DUE_DATE] >= _min && ACCOUNTS_PAYABLE[INVOICE_DUE_DATE] <=_max)
)
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.
- Syndicate_Admin5 years ago
Administrator
super
so that a 0 comes out in case there is no data I have completed it with
var _min = today()-365var _max = today()VAR Abiertos365 =CALCULATE(......)RETURNIF(ISBLANK(Abiertos365),0, Abiertos365)- Ashish_Mathur5 years ago
Super User
Hi,
You may try this measure
=coalesce([Abiertos365],0)
Hope this helps.