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

Number of Days fall on weekday

Hi All,

I would like to count number of days fall on certain day (Sun, Mon, etc) providing StartDate and EndDate.

The following is the data structure:

PowerBIOrg_2-1663900843274.png

 

I expect the output as following:

1) Filtered Date: 2022-08-01 to 2022-09-30:

PowerBIOrg_4-1663900961761.png

2) Filterd Date: 2022-09-01 to 2022-09-10

PowerBIOrg_0-1663903595030.png

 

 

Thanks!

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure about the result that is shown in your sample, but please check the below picture and the attached pbix file.

It is for creating a measure.

 

Jihwan_Kim_1-1663902935979.png

 

 

 

Jihwan_Kim_0-1663902925202.png

 

Expected result measure: =
SUMX (
    Data,
    CALCULATE (
        COUNTROWS (
            FILTER (
                'Calendar',
                'Calendar'[Date] >= MAX ( Data[StartDate] )
                    && 'Calendar'[Date] <= MAX ( Data[EndDate] )
            )
        )
    )
)

 

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.


Go to My LinkedIn Page


View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

I am not sure about the result that is shown in your sample, but please check the below picture and the attached pbix file.

It is for creating a measure.

 

Jihwan_Kim_1-1663902935979.png

 

 

 

Jihwan_Kim_0-1663902925202.png

 

Expected result measure: =
SUMX (
    Data,
    CALCULATE (
        COUNTROWS (
            FILTER (
                'Calendar',
                'Calendar'[Date] >= MAX ( Data[StartDate] )
                    && 'Calendar'[Date] <= MAX ( Data[EndDate] )
            )
        )
    )
)

 

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.


Go to My LinkedIn Page


Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Dev Camp Session 26

Check it Out!

Mark your calendars and join us on Thursday, September 29 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors