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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Datagulf
Responsive Resident
Responsive Resident

How to create Age bins

I want to replicate the following table and am looking for the formula to achieve so. 

Datagulf_0-1669993067439.png

I have a Quotes with data that is as the following. 

Quote IDClient Name Quote Date 
1NAme1 12/11/2022 
2 NAme2 11/11/2022 
3 NAme3 09/11/2022 
4 NAme4 06/11/2022 
5 NAme5 02/11/2022 
6 NAme6 09/10/2022 
7 NAme7 09/07/2022 
8 NAme8 02/07/2022 
9 NAme9 05/06/2022 


The plan is to have the count of the quotes clustered in 0-30 days from today, 30-60 days from today and 60-90 days. All that surpasses should be in the rest than 90 days .. 
So if today's date is 2/12/2022, then it should go back and check up to 2/11/2022 and input the number of quotes that fall in that bracket between 0-30 days, and between 02/11/2022 to 02/10/2022 - Should input all that are 30 -60 days. 
Please assist. Thanks

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Datagulf , You can create a column like

 

New column =

var _day = datediff([Date], Today(), day)

return

Switch( True(),

_day <=30 , "   0- 30",

_day <=60 , "   31- 60",

_day <=90 , "   61- 90",

"> 90 ")

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Datagulf , You can create a column like

 

New column =

var _day = datediff([Date], Today(), day)

return

Switch( True(),

_day <=30 , "   0- 30",

_day <=60 , "   31- 60",

_day <=90 , "   61- 90",

"> 90 ")

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.