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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Count how many days between 2 given dates and plot it

Dear Community, good morning.

 

I am creating a report analyzing the shipment in / out date in order to manage warehousing operations and have the below issue:

 

I have a table containing a data like this, so the cargo ID , the day the cargo arrived at the warehouse and the day that it left the warehouse.

 

Cargo IDEntered DayReleased Date
A01/01/202103/01/2021
B02/01/202104/01/2021
C01/01/202102/01/2021

 

What I need to do is create a graph showing the total cargoes by date, so I would neet to change the table to something like this:

 

Cargo IDDay
A01/01/2021
A02/01/2021
A03/01/2021
B02/01/2021
B03/01/2021
B04/01/2021
C01/01/2021
C02/01/2021

 

And plot like below:

Pedro_Okazaki_1-1655558659913.png

 

What is the best way to do this?

 

Thank you in advance!

 

1 ACCEPTED SOLUTION
speedramps
Super User
Super User

Click here to download a solution 

 

You need to build a calendar table with contagious dates

the create this measure ..

 

Valid cargos =
VAR mydate = SELECTEDVALUE('Calendar'[Date])
VAR validrows = FILTER(Cargos, Cargos[Entered Day] <= mydate && Cargos[Released Date] >= mydate)
RETURN
 
Then use calendar date in you graph x-axis and the [Valid cargos ] as the Y-axis value
COUNTROWS(validrows)
 

Thanks for reaching out for help.

I have helped you, now please help me by giving kudos.

Remeber we are unpaid volunteers.

Click the thumbs up and accept as solution button. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volnteer solver will get the kudos they deserve. Thank you !

View solution in original post

3 REPLIES 3
speedramps
Super User
Super User

Hi agian Pedro

 

Thanks for accepting the solution  😀

 

I am a vounteer. Please try ask one question per ticket. That way I get twice the solving score ! 😀😀

Quote @speedramps and I will received a notofication, but other solvers may help.

 

I recommend you turn off auto date integence .  Only novices use it.

It you want to be a serious Power Bi developer then build a Calender table, test it once and use it always ...

Do all these tutorials a few times and you will become an expert at YTD, MTD, LY, LM, Quarters  ...   

Click here to start learning 

 

You will also need to change the measure if you use Month or Quarters in your X-axis.

 
Valid cargos =
VAR mindate = MIN('Calendar'[Date])
VAR maxdate = MIN('Calendar'[Date])
VAR validrows = FILTER(CargosCargos[Entered Day] <= maxdate && Cargos[Released Date] >= mindate)
RETURN

 

Thanks for reaching out for help.

I have helped you, now please help me by giving kudos.

Remeber we are unpaid volunteers.

Click the thumbs up and accept as solution button. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volnteer solver will get the kudos they deserve. Thank you ! 😎

speedramps
Super User
Super User

Click here to download a solution 

 

You need to build a calendar table with contagious dates

the create this measure ..

 

Valid cargos =
VAR mydate = SELECTEDVALUE('Calendar'[Date])
VAR validrows = FILTER(Cargos, Cargos[Entered Day] <= mydate && Cargos[Released Date] >= mydate)
RETURN
 
Then use calendar date in you graph x-axis and the [Valid cargos ] as the Y-axis value
COUNTROWS(validrows)
 

Thanks for reaching out for help.

I have helped you, now please help me by giving kudos.

Remeber we are unpaid volunteers.

Click the thumbs up and accept as solution button. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volnteer solver will get the kudos they deserve. Thank you !

Anonymous
Not applicable

Hello Speedramps,

 

First, thank you for the quick reply! Much appreciated.

 

Quick question as I saw your PBIX, you use the date calendar without the hierarchy, but I need to be able to freely go to lets say quarter total, month total and day.

 

Is it possible?

 

 

Helpful resources

Announcements
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!

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