datediff

dida

New Member
Joined
Jun 27, 2011
Messages
15
[FONT=&quot] I Have one table of calendar in the query simply dates. another table of projects and start date of the projects.[/FONT]
[FONT=&quot]I wish to choose the project and then get in the calendar table another columns that compare the chosen project start date to the date in the calendar/ I could not find any way to do it. date diff doesn't not work with chosen from slicer[/FONT]
PROJdate
A13/01/2016
B19/01/2016
C04/01/2016

<tbody>
</tbody>
[FONT=&quot] [/FONT]
datedate diff from project
01/01/2016
02/01/2016
03/01/2016
04/01/2016
05/01/2016
06/01/2016
07/01/2016
08/01/2016
09/01/2016
10/01/2016
11/01/2016
12/01/2016

<tbody>
</tbody>
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
What output are you expecting, examples please.

if I choose in the slicer project A I wish to get the gap in days from the starting date of project A as follow
datedate diff from project
01/01/2016-12
02/01/2016-11
03/01/2016-10
04/01/2016-9
05/01/2016-8
06/01/2016-7
07/01/2016-6
08/01/2016-5
09/01/2016-4
10/01/2016-3
11/01/2016-2
12/01/2016-1
13/01/20160
14/01/20161
15/01/20162
16/01/20163
17/01/20164
18/01/20165
19/01/20166
20/01/20167
21/01/20168
22/01/20169
23/01/201610

<colgroup><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
With your selected project in D1
and your tables in A1 and A6

in B7
=A7-VLOOKUP(D$1,A$2:B$4,2,0)
format column B 2nd table as general, not dates/
 
Upvote 0
if this is a PowerQuery try

PowerQuery OR PivotTable with PQ
Selectiondate.1SubtractionPROJB
B
01/01/2016​
18​
02/01/2016​
17​
date.1Subtraction
03/01/2016​
16​
01/01/2016
18​
04/01/2016​
15​
02/01/2016
17​
05/01/2016​
14​
03/01/2016
16​
06/01/2016​
13​
04/01/2016
15​
07/01/2016​
12​
05/01/2016
14​
08/01/2016​
11​
06/01/2016
13​
09/01/2016​
10​
07/01/2016
12​
10/01/2016​
9​
08/01/2016
11​
11/01/2016​
8​
09/01/2016
10​
12/01/2016​
7​
10/01/2016
9​
11/01/2016
8​
12/01/2016
7​

example excel file
 
Upvote 0
thank you very much but how would it work in power BI? the data I bring from DATABASE to power query and wish to chose the project in the slicer
 
Upvote 0
as I can see you've two tables
so adapt M-code to merge these tables and your slicer will be as selection
 
Upvote 0
is that what you want?

example pbix

AMAZING!!! yes! the final results it's exactly what I needed, I just could not figure how to get to it.
since I have to table one of dates and the other of project and their start date, I saw that you created table tha combined with the larger value, i Mean for each date the project and then the datediff, how? did you did it manualy? becouse I can not, the model will keep getting new projects all the time, secondly, I can not see the measure od the datediff, how did you do it? third, another challenge - each project have exactly different start and end date, the first date is the start date of the project, I used MDX calendar and thought of filtering later bigger then 0... but maybe its not the best way, since the calendar MDX you can choose start date and end date. the reason is that in the end I need graph that start in different date for each project that I chose in the slicer, but if you could answer only on the first and second I will so appreciate it!
 
Upvote 0

Forum statistics

Threads
1,214,385
Messages
6,119,208
Members
448,874
Latest member
b1step2far

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top