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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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