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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
apmulhearn
Helper III
Helper III

Best Way to Group Numbers together to create categories (within 1 day, within 1 month, etc...)

Hello!
(Thank you in advance for help).


I have a table of Customers, the dates they inquire about our product, and the dates they actually purchase them. I then have a calculated column which tells me the Date Difference between the two.

I would like to know the best way to categorize these items into the following conversion breakdowns (column in purple font):
Within a week

Within a month

Within 3 months

Within 6 months

Within 1 year

Over a year

Grouping doesn't seem to be a good option because I don't have all of the values in my data set already.
Is a long IF Statement in another column the way to go, or is there something better?

 

 

CustomerInquiryDatePurchaseDateDaysBetweenCategory
ABCDEFG1/1/20202/3/202032Within 3 months
HGIDLSJ5/1/20235/7/20236Within 1 week
KOPNNOUHU3/1/20203/8/2021372Over 1 Year
JIOFIDOSHO9/1/20219/3/20212Within 1 week
JNIJFKNI6/1/20226/27/202226Within 1 month
1 REPLY 1
MFelix
Super User
Super User

Hi @apmulhearn ,

 

In this case believe the best option is the switch statement since the number of days can be variable, and you can define the less than X days to determine the 1 week, 1 months, and so on, you can do this also in Power query with the conditional column.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.