Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

If date between project date ranges return value, if outside date range return ZERO

Hi, 

 

I am currently desiging a project report and have a problem getting the right figures in each column for weekly figures

 

For Example, this is how the data is stored

 

Peter Smith (Project Dates) 1st Nov to 30th November (Project hours) 20hrs

 

I need a table that pro ratas the 22hrs over the number of weeks in November

 

So it should look like this in the columns

 

Peter Smith (WE 5th Nov) 5hrs, (WE12th) 5hrs, (WE 19th) 5hrs, (WE 26th) 5hrs = Total 20hrs

 

I can get the DAX to show the 5hrs in the final week but not in the previous weeks...

 

Calculate (VALUES ('RPPlan'[Hrs Per Week]), FILTER ( ALL( 'WeekEndDate') , ('WeekEndDate'[WeekEndDate] > MIN('RPPlan'[StartDate]) && 'WeekEndDate'[WeekEndDate] <= MAX('RPPlan'[WeekEndDate]))))
 
The project date range in the data on each row can be anything from 1 day to 1 year.
 
Any help appreciated
 
thanks

10 Replies

  • Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
    If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
    Please show the expected outcome based on the sample data you provided.

    If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

  • Anonymous's avatar
    Anonymous
    Not applicable
    PROJECTNAMEStart DateEnd DateHours AssignedWorking Days in PeriodHrs Per Day
    KANGAROOPeter Smith16//09/202331/10/202350321.563
    BADGERJohn Doe01/10/202331/10/202322211.048
    LIONJane Taylor01/10/202307/10/20234058.000
    TIGERLou Reed01/11/202330/11/2023176228.000
    • Anonymous's avatar
      Anonymous
      Not applicable
      End DateWeek Ending DateWorking Days
      16/09/202317/09/20235
      17/09/202317/09/20235
      18/09/202324/09/20235
      19/09/202324/09/20235
      20/09/202324/09/20235
      21/09/202324/09/20235
      22/09/202324/09/20235
      23/09/202324/09/20235
      24/09/202324/09/20235
      25/09/202301/10/20235
      26/09/202301/10/20235
      27/09/202301/10/20235
      28/09/202301/10/20235
      29/09/202301/10/20235
      30/09/202301/10/20235
      01/10/202301/10/20235
      02/10/202308/10/20235
      03/10/202308/10/20235
      04/10/202308/10/20235
      05/10/202308/10/20235
      06/10/202308/10/20235
      07/10/202308/10/20235
      08/10/202308/10/20235
      09/10/202315/10/20235
      10/10/202315/10/20235
      11/10/202315/10/20235
      12/10/202315/10/20235
      13/10/202315/10/20235
      14/10/202315/10/20235
      15/10/202315/10/20235
      16/10/202322/10/20235
      17/10/202322/10/20235
      18/10/202322/10/20235
      19/10/202322/10/20235
      20/10/202322/10/20235
      21/10/202322/10/20235
      22/10/202322/10/20235
      23/10/202329/10/20235
      24/10/202329/10/20235
      25/10/202329/10/20235
      26/10/202329/10/20235
      27/10/202329/10/20235
      28/10/202329/10/20235
      29/10/202329/10/20235
      30/10/202305/11/20235
      31/10/202305/11/20235
      01/11/202305/11/20235
      02/11/202305/11/20235
      03/11/202305/11/20235
      04/11/202305/11/20235
      05/11/202305/11/20235
      06/11/202312/11/20235
      07/11/202312/11/20235
      08/11/202312/11/20235
      09/11/202312/11/20235
      10/11/202312/11/20235
      11/11/202312/11/20235
      12/11/202312/11/20235
      13/11/202319/11/20235
      14/11/202319/11/20235
      15/11/202319/11/20235
      16/11/202319/11/20235
      17/11/202319/11/20235
      18/11/202319/11/20235
      19/11/202319/11/20235
      20/11/202326/11/20235
      21/11/202326/11/20235
      22/11/202326/11/20235
      23/11/202326/11/20235
      24/11/202326/11/20235
      25/11/202326/11/20235
      26/11/202326/11/20235
      27/11/202303/12/20235
      28/11/202303/12/20235
      29/11/202303/12/20235
      30/11/202303/12/20235
    • Anonymous's avatar
      Anonymous
      Not applicable

      Base Data

      • lbendlin's avatar
        lbendlin
        Icon for Super User rankSuper User

        Thank you for the sample data.  Next you need to indicate what you mean by 5 working days.  For example 2023-09-16 was a saturday.  Is that considered to be a working day?  or should it be ignored? Do you want to consider holidays?

         

         

  • Anonymous's avatar
    Anonymous
    Not applicable
    PROJECTNAMEStart DateEnd DateHours AssignedWorking Days in PeriodHrs Per Day17/09/202324/09/202301/10/202308/10/202315/10/202322/10/202329/10/202305/11/202312/11/202319/11/202326/11/202303/12/2023TOTAL
    KANGAROOPeter Smith16//09/202331/10/202350321.5633.1257.81257.81257.81257.81257.81257.81250000050
    BADGERJohn Doe01/10/202331/10/202322201.1000005.55.55.55.50000022
    LIONJane Taylor01/10/202307/10/20234058.000000400000000040
    TIGERLou Reed01/11/202330/11/2023176228.00000000002440404032176
           3.1257.81257.812553.312513.312513.312513.31252440404032288
    • Anonymous's avatar
      Anonymous
      Not applicable

      Expected Result

  • Anonymous's avatar
    Anonymous
    Not applicable

    The first table is the data

    The Second Table is the calendar Table

    The third table is the expected result

     

    ANy help greatly appreciated