Forum Discussion

San_Raz's avatar
San_Raz
Frequent Visitor
1 year ago
Solved

Marking Dates In Between Two Dates (for Displaying Time Spread in days of an activity)

I have two tables 
Table 1 : WorkSchedule

 ActivityDate Expected Finish Client
 A01/01/2025 04/01/2025 SS
 A01/01/2025 3/01/2025 DD
 C05/01/2025 8/01/2025 SS


And table two is a Date Table.

I have connected the date column in date table to the Date column in WorkSchedule table  using a One to many relationship 
with Workschedule lying in the many side.



I need to create matrix table with the dates and activities listed down as below. the dates in-between the Date and ExpectedFinish to be counted as 1.

ActityClient01/01/202502/01/202503/01/202504/01/202505/01/202506/01/202507/01/202508/01/202509/01/202510/01/202511/01/202512/01/2025
ASS1111        
ADD111         
CSS    1111    



Also, i have been trying the beow dax but it is only  counting  the start dates with 1
Count_Working = COUNTX
                                           (FILTER(WorkSchedule,
                                                          WorkSchedule[Date] <= MAX(Date[Date]) &&
                                                           WorkSchedule[EXPECTED FINISH] >= MAX(Date[Date])),
                                                           WorkSchedule[Activity])
Let me know if any other info is required

  • Sorry for tytping mistake.

    I have corrrected it

     

    Answer = 
    VAR mydate = SELECTEDVALUE('Calendar'[Date])
    VAR tempfile = 
    FILTER(yourdata, 
    mydate >= yourdata[Start date] &&
    mydate <= yourdata[Finish date]
    )
    RETURN
    COUNTROWS(tempfile)

     

     

     

     

7 Replies

  • I think you can use

    Date is active =
    VAR StartDate =
        SELECTEDVALUE ( WorkScheduleWorkSchedule[Date] )
    VAR EndDate =
        SELECTEDVALUE ( WorkSchedule[Expected Finish] )
    VAR CurrentDate =
        SELECTEDVALUE ( 'Date'[Date] )
    VAR Result =
        IF ( StartDate <= CurrentDate && CurrentDate <= EndDate, 1 )
    RETURN
        Result
    
      • speedramps's avatar
        speedramps
        Icon for Super User rankSuper User

        Sorry for tytping mistake.

        I have corrrected it

         

        Answer = 
        VAR mydate = SELECTEDVALUE('Calendar'[Date])
        VAR tempfile = 
        FILTER(yourdata, 
        mydate >= yourdata[Start date] &&
        mydate <= yourdata[Finish date]
        )
        RETURN
        COUNTROWS(tempfile)

         

         

         

         

  • Try this ....

     

    Remove the Calendar relationship.

    )Calendar relations should not be used forstart to finish date sceranrios because the rleationshiop will only work on one date and not the dates inbetween)

     

    Create measure (using you own table and column names)

     

    Answer = 
    VAR mydate = SELECTEDVALUE('Calendar'[Date])
    VAR tempfile = 
    FILTER(yourdata, 
    mydate >= yourdata[Start date] &&
    mydate <= yourdata[Finish date]
    )
    RETURN
    COUNTROWS(yourdata)

     

     

    Add a matric visual to your reports

     

    Please click the [accept solution] and thumbs up button.

    At the very least click the thumbs up button to show your appreciation.

    Thank you. ğŸ˜€

    • San_Raz's avatar
      San_Raz
      Frequent Visitor

      Hi,
      In your A -SS ends on 05th , but in your result it is counted for days after that also.
      I also tested your approach, but it is giving Wrong output