Forum Discussion

Devtr's avatar
Devtr
Helper III
3 years ago
Solved

Group the column based on two date columns

Hello teachers.

I have some hotel data for future reservations.

All the reservations have rate categories, rate, check-in date, check-out date, and other fields.

I wanted to compare past reservations vs future reservations using rate categories. That way reports can tell me who is giving more business.

Future reservations:

room_no     room_type    source    arrival_date    departure_date     persons    rooms    nights         rate     rate_cat      made_on    by_user  
211XLONBooking.com10/16/202211/8/20221123118.85IDME29/22/2022john
201XSTNExpedia10/22/202211/4/20221113139.92IDME210/20/2022jane
231KNGN 10/22/202211/4/20221113129.63ILW4L10/20/2022john
 TQNNMicrosoft10/24/202211/7/2022111499.2IKME39/11/2022john
 TQNNApple10/25/202210/31/2022216122.55IKME310/21/2022john
 KNGNGoogle10/25/202210/31/2022116117.8IKME310/21/2022jane
 KNGN 10/25/202211/3/202211998IMGOV10/24/2022jane
 KNGN 10/27/202211/1/2022115110IGNSF10/26/2022jane
 KNGNExpedia10/27/202211/1/2022115112.5IMMLR10/27/2022jane

 

KNGNPriceline10/27/202212/5/2022213987.88IGNSF10/23/2022

jane

 

Is there a way to show each rate category with their month-year, total nights, and average rate as below?

   rate_cat       month_year    nights    avg_rate  
IDME2Oct-2226129.39
IDME2Nov-2210129.39
IGNSFOct-221098.94
IGNSFNov-223098.94
IGNSFDec-22498.94
IKME3Oct-2220113.18
IKME3Nov-226113.18
ILW4LOct-2210129.63
ILW4LNov-223129.63
IMGOVOct-22798
IMGOVNov-22298
IMMLROct-225112.5

 

I am new to Power Bi. And I am not sure how can you obtain this kind of result from the data above in PB.

Download the excel file here 

Thank you all for your help.

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    HI Devtr,

    It sounds like a common multiple date fields analysis requirement, you can take a look at Greg's blog 'start date', 'end date' parts if it helps:

    Before You Post, Read  

    Regards,

    Xiaoxin Sheng

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI Devtr,

    It sounds like a common multiple date fields analysis requirement, you can take a look at Greg's blog 'start date', 'end date' parts if it helps:

    Before You Post, Read  

    Regards,

    Xiaoxin Sheng

  • I made the row data as monthly. I added few additional columns in power query. And resolved the issue. Thanks though.