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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

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
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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