Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Compare dates

I have a table where it has following records

 

Sem título.png

I have a calendar dimension table for on my report and it has one slicer for filter dates. I need to show the ocuppation rate during the priod filter on slicer.

If the slicer stay in 07/01/2019 until 07/31/2019, I can't to use the fields "amount day" where check-out is bigest that 07/31/2019(last 2 lines in the table sample), and I need to calculate the date interval in check-in em max(calendar[date])

I did like this


if (table[checkout].[Date] >= max(calendar[date]);
DATEDIFF(max(calendar[date]);table[checkin];DAY);
table[amount days]
)

But not working, for example, in this first line of the table, it returned 30 days and I don´t know why.

My doubt is, how to compare date in power bi?

6 REPLIES 6
Anonymous
Not applicable

is your calendar table marked as a date table?

How to Mark as Date Table.png

 

If it's not it will cause some problems with the built-in time intelligence functions.

Anonymous
Not applicable

Hi Nick, thanks for answering.

 

I did that you suggested and the problem persit. Look this:

 

error.png

In the highlighted line the date of checkout is biggest 31/07/2019, so the amount of "days ocuppation filter" have to be 7 days(calendar[date] - table[checkin] e not 15 days.

I undestand that my conditional not work:

if (table[checkout].[Date] >= max(calendar[date]);
DATEDIFF(max(calendar[date]);table[checkin];DAY);
table[amount days]
)

Anonymous
Not applicable

Can you upload some sample data?

Anonymous
Not applicable

How I do upload the file .xls in this forum? I could't, so I send this print.

 

sample.png

Anonymous
Not applicable

Onedrive or dropbox works.

Anonymous
Not applicable

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors