Forum Discussion
Aging debtor categorized by invoice date
Hi,
I hope someone can help me with this issue.
I want to categorize the following invoices by aging date into following categories
* 0-1 year
*1-2 year
*2-3 year
*3- year
My data looks like this:
| Account customer label | Invoice number | Invoice date | Invoice open amount |
| A | 100 | 15-11-16 | 10.000 |
| B | 101 | 21-11-17 | 25.000 |
| C | 102 | 30-11-17 | 5.000 |
| D | 103 | 18-12-17 | 15.000 |
| E | 104 | 19-01-18 | 8.500 |
| F | 105 | 02-02-18 | 8.950 |
| G | 106 | 05-02-18 | 17.500 |
| H | 107 | 22-11-19 | 23.000 |
| I | 108 | 23-11-19 | 30.000 |
I hope You can help with a Dax code 🙂
Søren
- Anonymous6 years ago
Hi Anonymous ,
You want a column or a measure?
Column = var diff = DATEDIFF('Table'[Invoice date],TODAY(),MONTH) return SWITCH(TRUE(),diff<12&&diff>=0,"0-1 year",diff>=12&&diff<24,"1-2 year",diff>=24&&diff<36,"2-3 year","3- year") Measure = var diff = DATEDIFF(selectedvalue('Table'[Invoice date]),TODAY(),MONTH) return SWITCH(TRUE(),diff<12&&diff>=0,"0-1 year",diff>=12&&diff<24,"1-2 year",diff>=24&&diff<36,"2-3 year","3- year")Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- amitchandak
Super User
Anonymous , Try both as new columns
Age = datediff([invoice_date],today(),month) switch(true(), [Age] <=12, "0-1 year", [Age] <=24, "1-2 year", [Age] <=36, "2-3 year", ">3 year")- AnonymousNot applicable
Hi and thanks for the quick response 🙂
[invoice date] is not a "Meassure" in my dateset, so I cannot use it in code. Do you have a solution for that? 🙂
- camargos88
Community Champion
Anonymous ,
You can try it using Power Query:
If you consider it as a solution, please mark as a solution and kudos.
Ricardo
- AnonymousNot applicable
Hi Anonymous ,
You want a column or a measure?
Column = var diff = DATEDIFF('Table'[Invoice date],TODAY(),MONTH) return SWITCH(TRUE(),diff<12&&diff>=0,"0-1 year",diff>=12&&diff<24,"1-2 year",diff>=24&&diff<36,"2-3 year","3- year") Measure = var diff = DATEDIFF(selectedvalue('Table'[Invoice date]),TODAY(),MONTH) return SWITCH(TRUE(),diff<12&&diff>=0,"0-1 year",diff>=12&&diff<24,"1-2 year",diff>=24&&diff<36,"2-3 year","3- year")Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.