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
gunther15
Frequent Visitor

Create Hit Rate range with first quoted date and PO Date

Hi I was wondering what logic I need to build in to create a hit rate range for this:

Days to First Order (days between FirstQuotedDate and BrandFirstOrderedDate):
1 - 91: 0 to 3 Months
92 - 182: 3 to 6 Months
183 - 273: 6 to 9 Months
274 - 364: 9 to 12 Months
365+: 12 Months or older

Here is an example of some of the data I have:

gunther15_0-1663679265854.png

 

gunther15_1-1663679297653.png

The PO date is the brand first ordered date in this case.  I was wondering how what logic I need to create that hit rate range from the data I have above.

 

Thank you

 

 

1 REPLY 1
JamesRobson
Resolver II
Resolver II

Hi,

 

 I would start with a helper column to get the age

= Table.AddColumn(#"Changed Type1", "Age", each Duration.Days(Date.From([First Quoted Date]) - Date.From([PO Date])))

 

then a column to label the category

= Table.AddColumn(#"Added Age", "Category", each if [Age] < 92 then "0 to 3 Months"
else if [Age] < 183 then "3 to 6 Months"
else if [Age] < 274 then "6 to 9 Months"
else if [Age] < 365 then "9 to 12 Months"
else "12 Months or Older")

 

Whole query below

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type1" = Table.TransformColumnTypes(Source,{{"PO Date", type date}, {"First Quoted Date", type date}}),
#"Added Age" = Table.AddColumn(#"Changed Type1", "Age", each Duration.Days(Date.From([First Quoted Date]) - Date.From([PO Date]))),
#"Added Category" = Table.AddColumn(#"Added Age", "Category", each if [Age] < 92 then "0 to 3 Months"
else if [Age] < 183 then "3 to 6 Months"
else if [Age] < 274 then "6 to 9 Months"
else if [Age] < 365 then "9 to 12 Months"
else "12 Months or Older")
in
#"Added Category"

 

There probably is a clever way to do it in one step but I'm not that good 🙂 

 

Thanks,

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors