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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Create Aging Bucket. - formula help.

Hi Power BI gurus, 

 

I am farily new to Power BI,  might ask some simple questions, but please kindly help!   🙂

 

I am trying to create couple new fields related to Aging bucket ( Account receivable)

 

1. Days Past Due:  is the days difference between report date and due date,  I simply used the folumar = 1.0* ([Report Date]-[due date]), and it works.. 

 

2.  then I want to create a categorical field - Aging bucket  with an conditonal formular, please see below.  The questions is  that it won't let me to add “AND" logic in one single condition. For example, if date_diff is greaten then 1 AND also less then 30, then "1-30Days". 

 

Over all, I am looking for this field with logic:

 - if date_diff less then 1, then "current", elseif Date_Diff>1 and also <30 then "1-30 Days"; elseif Date_Diff>31 and also <60 then "31-60 Days".... etc.

 

In additon,  is there other ways to create the measure instead of using the conditonl column?  I am not very familiar with writing formula.. if someone could further advise, I really appericate it. 

 

Thank you,

Flora

 

PBI-Aging bucket.JPG

 

 

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

Hi @Anonymous,

 

You can create a custom column in Query Editor use Power Query below: 

 

=if [date_diff] <=1 then "current" else if [date_diff] > 1 and [date_diff] <30 then "1-30 Days" else if [date_diff]>= 30 and [date_diff] < 60 then "31-60 Days" else null

 

q4.PNG

 

To create a measure, we need to back to report level use DAX. 

 

Measure = IF(MAX([date_diff]) <=1 , "current",IF( MAX([date_diff]) > 1 && MAX([date_diff])<30,  "1-30 Days",IF(MAX([date_diff])>= 30 && MAX([date_diff]) < 60, "31-60 Days",  BLANK())))

 

q5.PNG

 

You can downlaod attached pbix file to have a look. 

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
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
v-qiuyu-msft
Community Support
Community Support

Hi @Anonymous,

 

You can create a custom column in Query Editor use Power Query below: 

 

=if [date_diff] <=1 then "current" else if [date_diff] > 1 and [date_diff] <30 then "1-30 Days" else if [date_diff]>= 30 and [date_diff] < 60 then "31-60 Days" else null

 

q4.PNG

 

To create a measure, we need to back to report level use DAX. 

 

Measure = IF(MAX([date_diff]) <=1 , "current",IF( MAX([date_diff]) > 1 && MAX([date_diff])<30,  "1-30 Days",IF(MAX([date_diff])>= 30 && MAX([date_diff]) < 60, "31-60 Days",  BLANK())))

 

q5.PNG

 

You can downlaod attached pbix file to have a look. 

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

This is a great example, but is there a way around this in Direct Query

 

Thanks a million?

Anonymous
Not applicable

HI Qiuyun,

 

This is exactly what I am looking for, and thanks for sharing more than one solutions.  Good to learn both.   🙂

 

Thank you!!

 

Flora

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors