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
Anonymous
Not applicable

Between two dates

Hello,

I have a column with date of begning and a column with a date of end.

 

I would like to create a report where I can see depending of the quarter of the years how many row are between those two dates.

For exemple how many rows have a date of begining before the fist quarter of 2021 and a date of end after the first quarter of 2021.

Hence I will be abble to know depending to the different quarter of the year how many row was between those dates.

A row can be count in the first quarter and in the second one, it will depends when the date of end will be.

 

To do that I start creting column called Q1_2021, Q2_2021...Q4_2021 where I put a 1 if the row has started but not ended during the corresponding quarter of 2021 or a 0 if it wasnt the case.

Hence I have 4 columns with the values 0 or 1, corresponding to the differents quarters.

I would like to have in the lines my quarters and in the columns the amount of row that are still active (the start date before the quarter and the end date after the quarter). But I can't achieve it. I only sucess to put my quarter in the columns and the amount in the lines. Could you help me pls?

Thank you

 

I would like somethink like this

Patop_0-1650015653150.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Using independent date table

 

new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = mainx(allselected(Date1),Date1[Date])
return

calculate(count(Table[case]), filter(Table, Table[Start_date] <= _max && table[EndDate] >=_min))

 

Also, check

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

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

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Using independent date table

 

new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = mainx(allselected(Date1),Date1[Date])
return

calculate(count(Table[case]), filter(Table, Table[Start_date] <= _max && table[EndDate] >=_min))

 

Also, check

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

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
Anonymous
Not applicable

Thank you!

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!

November Carousel

Fabric Community Update - November 2024

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

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.