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
zubair242
Frequent Visitor

count number of items between 2 different date columns

Hi everyone,

 

I have an interesting scenario where I want to know whether property/asset is in the market or not. I have Date sold column which shows when it is sold. 

 

Now, I want to calculate available properties on a particular day. For example, there are 2 properties on 22nd, 4 on 23rd( 2 new and 2 previous), 3 on 24th(1 new, 2 from 23rd, but properties which were available on 22nd sold on 24th). How can I calculate using DAX. Snapshot is attached with the sample PBI file.

 

https://drive.google.com/file/d/170YhhUi8Ymtsygbb7Eb6mTF6qC1afTIv/view?usp=sharing

 

 

zubair242_0-1724994848467.png

 

Regards,

Zubair

 

2 REPLIES 2
rajendraongole1
Super User
Super User

Hi @zubair242 - as per shared pbix and given inputs , on 23rd aug, we ill get available properties only 2 not 4. can you please check and let know if something is missed

rajendraongole1_1-1724997370620.png

 

Available Properties =
VAR CurrentDate = MAX('DateTable'[Date])
RETURN
CALCULATE(
COUNTROWS(
FILTER(
'YourTable',
'YourTable'[Active] = 1 &&
(
('YourTable'[Date] <= CurrentDate && ISBLANK('YourTable'[Date Sold])) ||
('YourTable'[Date] <= CurrentDate && 'YourTable'[Date Sold] > CurrentDate)
)
)
)
)

 

rajendraongole1_2-1724997439739.png

 

Hope this helps.

 

 

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thank you @rajendraongole1 .. When I implemented this, I got the properties which are currently active. I should have 2 active on 22nd and 4 on 23rd but I got the following. The first 2 properties became inactive on 24th. Hope that makes sense?

 

Required output:

zubair242_1-1724998481561.png

 

 

Current output:

zubair242_0-1724998427175.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.