cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Resolver III
Resolver III

Getting wrong project dates when generating table...

Hello PBI community:

 

I'm tracking revenue for projects over a few months; some projects generate revenue, and others stop (i.e., not cumulative total). 

 

I have a table that has one row for each project, but some projects span a few months. I need a row for each month each project spans. I have that down, but now I'm having an issue with the dates in the table I'm generating. I want the first row for a project to have a date that matches the start date of the project (and the second row to be the first date of the month for the next month the project generates revenue, and so on for subsequent months--to be clear, once we start work on a project, we continuosly work on it until it is completed).

 

Here is a table that shows each project with start & stop dates:

Project #Duration (Months) Expected MonthlyEst Start DateEst End Date
1001 $   12,000.00$12,000.001/1/20191/31/2019
2003 $   10,000.00$3,333.332/1/20194/30/2019
3002 $     3,000.00$1,500.001/1/20192/28/2019
4004 $     8,000.00$2,000.003/1/20196/30/2019
5002 $     2,000.00$1,000.002/1/20193/31/2019

 

The image below shows the first date for project 200, and it is incorrect.

 

PBI screenshot.jpg

 

 

I'm posting links to my data here:

 

My pbi file

My excel sheet (used as source for pbi file)

 

Any help is appreciated.

1 ACCEPTED SOLUTION

Hi @ccapowerbi

 

Please check if below table matches your request.

Table = 
FILTER (
    GENERATE (
        SELECTCOLUMNS ( 'My Date Table', "My Date", 'My Date Table'[Date] ),
        Projects
    ),
    Projects[Est Start Date] <= [My Date]
        && Projects[Est End Date] >= [My Date]
        && DAY ( [My Date] ) = 1
)

1.png

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Resolver III
Resolver III

For those who are curious, the 'temporary' table returns a number labeled [Value]. It seems to correspond to the month number. The fix is changing the expression associated with the 'Month' column in the table generated by SELECTCOLUMNS. I set the expression to this:

 

"Month", DATE(YEAR([Est Start Date]),[Value],1),
 
That gave me the appropriate date value for my rows. 
 
**You have to use [value] in the calculation as that is how the dates differ from line to line.**
 
If you don't use [Value], the table will apply the same date under the month column to each row. [Value] is the key to giving each row for a project (that spans more than 1 month) a different date.

Hi @ccapowerbi

 

Please check if below table matches your request.

Table = 
FILTER (
    GENERATE (
        SELECTCOLUMNS ( 'My Date Table', "My Date", 'My Date Table'[Date] ),
        Projects
    ),
    Projects[Est Start Date] <= [My Date]
        && Projects[Est End Date] >= [My Date]
        && DAY ( [My Date] ) = 1
)

1.png

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hey @v-cherch-msft

 

Thanks for taking the time to reply. Your solution works. I'm posting both PBIX files--one with my solution & one with yours so people can see both. 

 

ADDCOLUMNS / GENERATE / SELECTCOLUMNS solution

FILTER / GENERATE / SELECTCOLUMNS solution

 

Thanks so much.

 

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Wave Release 2

Check out the updates in Power BI.

Overview of Power BI 2020 release wave 2!

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors