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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
vinothkumar1990
Helper II
Helper II

Cumulative data in Dax

Hi,

I have 3 fileds which are Task, Planned Start Date and Planned End Date. I want calculate the cumulative count of Task based on the weekend(All Previous week+ Current week).

 

Raw Data:

TaskPlanned Start DatePlanned End Date
Task127-Feb-2328-Feb-23
Task228-Feb-237-Mar-23
Task37-Mar-238-Mar-23
Task413-Mar-2314-Mar-23
Task514-Mar-2315-Mar-23
Task615-Mar-2320-Mar-23

 

 

Expected Format:

Note : "Planned Start Date Count Calulation" and "Planned End Date Count Calulation" are just shown for calculation which is not required in visual.

Week End DatePlanned Start Date CountPlanned End Date CountPlanned Start Date Count CalulationPlanned End Date Count Calulation
4-Mar-232121
11-Mar-23332+11+2
18-Mar-23652+1+31+2+2
25-Mar-23662+1+3+01+2+2+1
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1678730420272.png

 

Jihwan_Kim_1-1678731040956.png

 

 

Planned start date count: =
IF (
    MIN ( 'Calendar'[Date] ) + 7
        >= MIN ( Data[Planned Start Date] )
        && MAX ( 'Calendar'[Date] ) - 7
            <= MAX ( Data[Planned End Date] ),
    CALCULATE (
        COUNTROWS (
            FILTER (
                Data,
                Data[Planned Start Date] <= MAX ( 'Calendar'[Date] )
                    && Data[Planned Start Date] >= MIN ( 'Calendar'[Date] )
            )
        ),
        WINDOW (
            1,
            ABS,
            0,
            REL,
            ALL ( 'Calendar'[WK enddate] ),
            ORDERBY ( 'Calendar'[WK enddate], ASC )
        )
    )
)

 

Planned end date count: = 
IF (
    MIN ( 'Calendar'[Date] ) + 7
        >= MIN ( Data[Planned Start Date] )
        && MAX ( 'Calendar'[Date] ) - 7
            <= MAX ( Data[Planned End Date] ),
    CALCULATE (
        COUNTROWS (
            FILTER (
                Data,
                Data[Planned End Date] <= MAX ( 'Calendar'[Date] )
                    && Data[Planned End Date] >= MIN ( 'Calendar'[Date] )
            )
        ),
        WINDOW (
            1,
            ABS,
            0,
            REL,
            ALL ( 'Calendar'[WK enddate] ),
            ORDERBY ( 'Calendar'[WK enddate], ASC )
        )
    )
)

 


 

    Microsoft MVP
 

 

   


      If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


   


     
        LinkedInVisit my LinkedIn page
     

   


   


     
        Outlook BookingSchedule a short Teams meeting to discuss your question

     

   


 


View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1678730420272.png

 

Jihwan_Kim_1-1678731040956.png

 

 

Planned start date count: =
IF (
    MIN ( 'Calendar'[Date] ) + 7
        >= MIN ( Data[Planned Start Date] )
        && MAX ( 'Calendar'[Date] ) - 7
            <= MAX ( Data[Planned End Date] ),
    CALCULATE (
        COUNTROWS (
            FILTER (
                Data,
                Data[Planned Start Date] <= MAX ( 'Calendar'[Date] )
                    && Data[Planned Start Date] >= MIN ( 'Calendar'[Date] )
            )
        ),
        WINDOW (
            1,
            ABS,
            0,
            REL,
            ALL ( 'Calendar'[WK enddate] ),
            ORDERBY ( 'Calendar'[WK enddate], ASC )
        )
    )
)

 

Planned end date count: = 
IF (
    MIN ( 'Calendar'[Date] ) + 7
        >= MIN ( Data[Planned Start Date] )
        && MAX ( 'Calendar'[Date] ) - 7
            <= MAX ( Data[Planned End Date] ),
    CALCULATE (
        COUNTROWS (
            FILTER (
                Data,
                Data[Planned End Date] <= MAX ( 'Calendar'[Date] )
                    && Data[Planned End Date] >= MIN ( 'Calendar'[Date] )
            )
        ),
        WINDOW (
            1,
            ABS,
            0,
            REL,
            ALL ( 'Calendar'[WK enddate] ),
            ORDERBY ( 'Calendar'[WK enddate], ASC )
        )
    )
)

 


 

    Microsoft MVP
 

 

   


      If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


   


     
        LinkedInVisit my LinkedIn page
     

   


   


     
        Outlook BookingSchedule a short Teams meeting to discuss your question

     

   


 


Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.