This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Solved! Go to Solution.
@Stuznet -
AND ( ) only takes two arguements so you'd have to nest if you wanted to go that way.
The following seems to work in my small sample that I created, possibly it will work for your data:
Aging =
VAR DaysBtwn =
IF (
ISBLANK ( Table1[DATE1] ),
BLANK (),
IF (
ISBLANK ( Table1[DATE2] ),
BLANK (),
( Table1[DATE1] - Table1[DATE2] ) * 1
)
)
RETURN
IF (
ISBLANK ( DaysBtwn ),
BLANK (),
SWITCH (
TRUE (),
DaysBtwn < 31, "0-30 Days",
DaysBtwn < 61, "30-60 Days",
DaysBtwn >= 61, "61+ Days"
)
)
Proud to be a Super User!
Try this and use && instead of AND() and || instead of OR() for cleaner code:
AgeDays =
// If either is blank, then nDays wil be blank
VAR nDays = DATEDIFF([Date1],[Date2],SECOND) / 60 / 60 / 24
SWITCH( TRUE(),
nDays < 31, "0-30 Days",
nDays < 61, "30-60 Days",
nDays >= 61, "61+ Days",
BLANK()
)
@Stuznet -
AND ( ) only takes two arguements so you'd have to nest if you wanted to go that way.
The following seems to work in my small sample that I created, possibly it will work for your data:
Aging =
VAR DaysBtwn =
IF (
ISBLANK ( Table1[DATE1] ),
BLANK (),
IF (
ISBLANK ( Table1[DATE2] ),
BLANK (),
( Table1[DATE1] - Table1[DATE2] ) * 1
)
)
RETURN
IF (
ISBLANK ( DaysBtwn ),
BLANK (),
SWITCH (
TRUE (),
DaysBtwn < 31, "0-30 Days",
DaysBtwn < 61, "30-60 Days",
DaysBtwn >= 61, "61+ Days"
)
)
Proud to be a Super User!
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 31 | |
| 26 | |
| 23 | |
| 22 | |
| 15 |
| User | Count |
|---|---|
| 63 | |
| 45 | |
| 28 | |
| 24 | |
| 22 |