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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
marcp2
Frequent Visitor

Counting items between dates day by day

Hi there

I try to manage a fleet of buses. I need to make a dashboard showing day by day the number of buses running vs the number of buses in the fleet.

 

I have two tables

Buses : with informations on each bus 

License plate, brand, type, date of first commercial operation, date of last commercial operation...

 

Journeys : with informations on trip operated by the buses fleet

Date of journey, License plate, line number, direction, start time, arrival time

 

I need a table showing something like this

date, number of buses having operated at least one journey in the day, number of buses in service (date between date of first commercial operation and date of last commercial operation).

 

Here is a very simplified example with a fleet of 2 buses

Buses

License plate

Brand

Type

First op

Last op

xx

A

A1

08/11/2017

10/11/2017

yy

B

B1

07/11/2017

11/11/2017

 

Journeys

Date

License plate

Line number

Direction

Start time

Arrival time

07/11/2017

yy

15

A

08:30

12:15

07/11/2017

yy

15

B

13:00

17:00

08/11/2017

xx

18

A

09:00

13:00

08/11/2017

xx

18

B

14:00

18:30

09/11/2017

yy

15

A

08:35

12:25

09/11/2017

yy

15

B

13:00

16:50

09/11/2017

xx

18

A

09:00

13:05

09/11/2017

xx

18

B

14:00

18:20

11/11/2017

yy

15

A

08:30

12:20

11/11/2017

yy

15

B

13:05

17:10

 

 

Buses in fleet

Buses running

06/11/2017

0

0

07/11/2017

1

1

08/11/2017

2

1

09/11/2017

2

2

10/11/2017

2

0

11/11/2017

1

1

12/11/2017

0

0

 

The license plate is the link between the buses and journeys table

I can't figure out the data model with a calendarauto table

I can't figure out the measures to properly count the number of buses in the fleet

 

Can you help me ?

Regards

Marc

 

1 REPLY 1
Greg_Deckler
Super User
Super User

Take a look at these two Quick Measures as I think you want something like them.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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