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
SpiroswayGR
Resolver III
Resolver III

Create Different Date bands

Hey everyone,

 

I want to create a few Date Bands and we have 2 different Dates, the 1st one is the system date, which shows the date that something was imported to the System and 2nd date is "Stay Date" which shows when one client stays in one Hotel.

 

We have 2 different seasons, meaning the full year created by "Stay Date". Let's say 2022 and 2021.

One Client might make a reservation from July 2021 to Dec 2022 (System Date) for Season 2022 or 

July 2020 to Dec 2021 (System Date) for Season 2021.

 

So I want to create some date periods and a graph like this

 

SpiroswayGR_0-1657875372732.png

Any idea ?

 

Keep in mind the notes above 🙂

 

Thanks in advance

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@SpiroswayGR , You have create a new column in date table  

 

Switch(True(),

[Date] >= date(2021,07,01) && [Date] <= date(2022,1,31) , "Jul 2021 to Jan 2022",

[Date] >= date(2022,02,01) && [Date] <= date(2022,3,31) , " Feb - Mar 2022",

format([Date], "mmm-yyyy")

 

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

3 REPLIES 3
amitchandak
Super User
Super User

@SpiroswayGR , You have create a new column in date table  

 

Switch(True(),

[Date] >= date(2021,07,01) && [Date] <= date(2022,1,31) , "Jul 2021 to Jan 2022",

[Date] >= date(2022,02,01) && [Date] <= date(2022,3,31) , " Feb - Mar 2022",

format([Date], "mmm-yyyy")

 

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

@amitchandak I love that you are in my mind !!

 

Quick question for sorting, is it an easy way to sort it according to months? 

I made ID columns like the calculate column but it doesn't work when I reach on months. Should we change the format?

 

DateBandID = 

Switch(True(),

[Date] >= date(2021,07,01) && [Date] <= date(2022,1,31) , "1",

[Date] >= date(2022,02,01) && [Date] <= date(2022,3,31) , " 2",

format([Date], "mmm-yyyy")

 

SpiroswayGR_0-1657877171831.png

 

@amitchandak 

I found a problem in solution,

I have 2 calendars that are connected with data, one normal calendar that is connected with the system date, and 2nd one which connected with the system date.

 

So, I can create different System Date bands for Season 2022 (Stay Date) but when I select Season 2021, I am getting totally wrong results. Because it calculates the System date that I had created instead of creating the same dates 1 year ago.

SpiroswayGR_0-1657879519563.png

 

 

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.