Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
kballar1
Helper I
Helper I

Aging Bucket With One Date Column

Hello,

 

I am creating a dashboard that needs to meet these requirements:

Visuals for both Receivables and Payables showing individual buckets. Sorting should be based on age: 

Current

0-30

31-60

61-90

91-120

 

Attached is a snippet is the only data I have to work with. Dates range from Feb 2024-May 2024.data.png I keep creating an aging bucket using this measure but it only shows up the 0-30 day bucket. Please help.

Age_Bucket = 
VAR _Age = DATEDIFF('Table'Due Date,'Table'[Due Date], DAY)
VAR _Result = 
SWITCH(
    TRUE(),
    _Age < 30, "0-30 days",
    _Age >= 31 && _Age < 60, "31-60 days",
    _Age >= 61 && _Age < 90, "61-90 days",
    _Age >= 91, "120+ days"
)
Return
_Result   

 

3 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

Age_Bucket = 
VAR _Age = DATEDIFF('Table'[Due Date], TODAY(), DAY)
RETURN SWITCH(
    TRUE(),
    _Age < 30, "0-29 days",
    _Age < 60, "31-59 days",
    _Age < 90, "60-89 days",
    "90+ days"
)

View solution in original post

aduguid
Memorable Member
Memorable Member

aduguid_0-1714360085681.png

aduguid_2-1714360383496.png

 

Calendar Aging = 
VAR _today_date = TODAY()
VAR _min_date =   CALCULATE(MIN(YourTable[Due_Date]))

VAR _result = 
UNION (
      ADDCOLUMNS (CALENDAR ( _today_date - 30, _today_date - 1),    "Aging Days", "0 to 30",   "Aging Days Order", 1)
    , ADDCOLUMNS (CALENDAR ( _today_date - 60, _today_date - 31 ),  "Aging Days", "31 to 60",  "Aging Days Order", 2)
    , ADDCOLUMNS (CALENDAR ( _today_date - 90, _today_date - 61 ),  "Aging Days", "61 to 90",  "Aging Days Order", 3)
    , ADDCOLUMNS (CALENDAR ( _today_date - 120, _today_date - 91 ), "Aging Days", "91 to 120", "Aging Days Order", 4)
    , ADDCOLUMNS (CALENDAR ( _min_date, _today_date - 121),         "Aging Days", "120+",      "Aging Days Order", 5)
)

RETURN
_result

 

View solution in original post

Anonymous
Not applicable

Hi @kballar1 

 

Thanks for the reply from @lbendlin  and @aduguid , please allow me to provide another insight:

 

Do you want to compare the maximum date in a table with the date of each row? If so, try the following formula.

 

Age_Bucket = 
VAR _MAX = CALCULATE(MAX([Due Date]), ALL('Table'))
VAR _Age = DATEDIFF(MAX([Due Date]), _MAX, DAY)
VAR _Result = 
SWITCH(
    TRUE(),
    _Age < 30, "0-30 days",
    _Age >= 31 && _Age < 60, "31-60 days",
    _Age >= 61 && _Age < 90, "61-90 days",
    _Age >= 91, "120+ days"
)
Return
_Result

 

I added the dates through May to your screenshot.

vxuxinyimsft_0-1714371818701.png

 

Result:

vxuxinyimsft_1-1714371872629.png

 

If I've misunderstood you, please feel free to let me know.

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @kballar1 

 

Thanks for the reply from @lbendlin  and @aduguid , please allow me to provide another insight:

 

Do you want to compare the maximum date in a table with the date of each row? If so, try the following formula.

 

Age_Bucket = 
VAR _MAX = CALCULATE(MAX([Due Date]), ALL('Table'))
VAR _Age = DATEDIFF(MAX([Due Date]), _MAX, DAY)
VAR _Result = 
SWITCH(
    TRUE(),
    _Age < 30, "0-30 days",
    _Age >= 31 && _Age < 60, "31-60 days",
    _Age >= 61 && _Age < 90, "61-90 days",
    _Age >= 91, "120+ days"
)
Return
_Result

 

I added the dates through May to your screenshot.

vxuxinyimsft_0-1714371818701.png

 

Result:

vxuxinyimsft_1-1714371872629.png

 

If I've misunderstood you, please feel free to let me know.

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

aduguid
Memorable Member
Memorable Member

aduguid_0-1714360085681.png

aduguid_2-1714360383496.png

 

Calendar Aging = 
VAR _today_date = TODAY()
VAR _min_date =   CALCULATE(MIN(YourTable[Due_Date]))

VAR _result = 
UNION (
      ADDCOLUMNS (CALENDAR ( _today_date - 30, _today_date - 1),    "Aging Days", "0 to 30",   "Aging Days Order", 1)
    , ADDCOLUMNS (CALENDAR ( _today_date - 60, _today_date - 31 ),  "Aging Days", "31 to 60",  "Aging Days Order", 2)
    , ADDCOLUMNS (CALENDAR ( _today_date - 90, _today_date - 61 ),  "Aging Days", "61 to 90",  "Aging Days Order", 3)
    , ADDCOLUMNS (CALENDAR ( _today_date - 120, _today_date - 91 ), "Aging Days", "91 to 120", "Aging Days Order", 4)
    , ADDCOLUMNS (CALENDAR ( _min_date, _today_date - 121),         "Aging Days", "120+",      "Aging Days Order", 5)
)

RETURN
_result

 

lbendlin
Super User
Super User

Age_Bucket = 
VAR _Age = DATEDIFF('Table'[Due Date], TODAY(), DAY)
RETURN SWITCH(
    TRUE(),
    _Age < 30, "0-29 days",
    _Age < 60, "31-59 days",
    _Age < 90, "60-89 days",
    "90+ days"
)

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.