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

Calculate the number of days between 2 dates based of a secondary column (flag)

Hi all, 

 

I am looking to show the number of days since latest date selected (from slicer) and annual leave recorded. A slicer also on dahsboard of the employee ID

I have column with everyday in it (calendardate) and a column that flags if annual leave is taken (1) or if it is not taken (0). 

Example data set below:

 

Calendar Date ID

Annual Leave

02/02/2023

1001

0

03/02/2023

10011
04/02/202310010
05/02/202310010
06/02/202310010
07/02/202310010
08/02/202310010
09/02/202310010

 

So for example data set above - date slicer set at 09/02/2022 - i would expect my KPI card to show 6 days since annual leave?

 

Any help would be great. Thanks

1 ACCEPTED SOLUTION

lbendlin_0-1678126166496.png

 

see attached.

 

View solution in original post

4 REPLIES 4
lbendlin
Super User
Super User

That looks straightforward.  What have you tried and where are you stuck?

Anonymous
Not applicable

Hi, 

 

To be honest I have tried a number of things and nothing seems to be working... My theory behind it was to calculate max date where =1 in Annual leave column and then subtract that from today but that doesn't seem to be working... your help would be greatly appreciated.

 

Thanks 

lbendlin_0-1678126166496.png

 

see attached.

 

Anonymous
Not applicable

Thanks very much... worked perfectly.

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.