cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Prodigy
Post Prodigy

Measure to return Days Past for current period/month from table as shown

Hi Experts

 

How would you write a measure to return the number of WorkingDaysPassed for Oct 18 from the table shown. I want to add the measure to a matrix table..

 

Capture.PNG

 

 

1 ACCEPTED SOLUTION
Community Support
Community Support

Hi @Route11,

 

You can try to use below measure to calculate remain working day based on today function and table date column:

Remain Working days = 
IF (
    TODAY () > ENDOFMONTH ( 'Sample'[Date] ),
    0,
    IF (
        FORMAT ( TODAY (), "mm/yyyy" )
            = FORMAT ( ENDOFMONTH ( 'Sample'[Date] ), "mm/yyyy" ),
        COUNTROWS (
            FILTER (
                CALENDAR ( TODAY (), ENDOFMONTH ( 'Sample'[Date] ) ),
                NOT ( WEEKDAY ( [Date], 1 ) IN { 1, 7 } )
            )
        ),
        COUNTROWS (
            FILTER (
                CALENDAR ( STARTOFMONTH ( 'Sample'[Date] ), ENDOFMONTH ( 'Sample'[Date] ) ),
                NOT ( WEEKDAY ( [Date], 1 ) IN { 1, 7 } )
            )
        )
    )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support
Community Support

Hi @Route11,

 

You can try to use below measure to calculate remain working day based on today function and table date column:

Remain Working days = 
IF (
    TODAY () > ENDOFMONTH ( 'Sample'[Date] ),
    0,
    IF (
        FORMAT ( TODAY (), "mm/yyyy" )
            = FORMAT ( ENDOFMONTH ( 'Sample'[Date] ), "mm/yyyy" ),
        COUNTROWS (
            FILTER (
                CALENDAR ( TODAY (), ENDOFMONTH ( 'Sample'[Date] ) ),
                NOT ( WEEKDAY ( [Date], 1 ) IN { 1, 7 } )
            )
        ),
        COUNTROWS (
            FILTER (
                CALENDAR ( STARTOFMONTH ( 'Sample'[Date] ), ENDOFMONTH ( 'Sample'[Date] ) ),
                NOT ( WEEKDAY ( [Date], 1 ) IN { 1, 7 } )
            )
        )
    )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

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