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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Count rows with different conditions related to dates

Hello everyone,

 

I am new to Power BI and I am stuck right now. I try to count rows with different conditions. Here is how my data looks like:

 

arnerck_0-1669276250552.png

 

I already have a diagram where data from a different table is visualized: 

arnerck_1-1669276419526.png

 

What I am trying to do now is to add a line chart with the number of vehicles on a certain day. On the first screenshot above, the table "Disposition" can be seen with the columns "Fahrzeugeingang_IST", this is the time at which a vehicle was delivered. "Fahrzeugrückgabe_IST" is the time at which the vehicle was returned. In addition, we have the column "Location".

 

I would now like to evaluate how many vehicles were there on a certain date at a certain location.
I have created a new date table and have tried to count the rows using the "COUNTROWS" function. However, I have not managed to include the date as a condition (count if the date is greater than "Fahrzeugeingang_IST", less than "Fahrzeugrückgabe_IST" and location "P1").

My idea was to insert a column with the name of every location and then to count the number of vehicles: 

 

arnerck_2-1669278108233.png

 

 

If you need any further information, please let me know. 

Thanks in advance for all your help!

 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , it seem like you need something like Active Employee in HR, refer blog of file

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

>> Seems legit but how can I also take the location (P1, P2, P3, ...) into credit? Do I need a new date table for every location or can I make this somehow as a condition in a row

if the relationship is one to many,

vxiaotang_1-1669714741602.png

maybe you can try this, 

vxiaotang_0-1669714666142.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , it seem like you need something like Active Employee in HR, refer blog of file

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak thank you for sharing the solution with me! 

 

Seems legit but how can I also take the location (P1, P2, P3, ...) into credit? Do I need a new date table for every location or can I make this somehow as a condition in a row?

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.