Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Excluding Weekends - Returning data from Friday on Monday otherwise previous day data

Hello!   I'm trying to run a calculation that returns data for the previous day but on Monday, I need to return Friday's values.   I know that the PREVIOUSDAY function doesn't work and think that...
  • v-zhangti's avatar
    4 years ago

    Hi, Anonymous 

     

    You can try the following methods.

    Column:

    Weekday = WEEKDAY([Date],2)

    Measure:

    Measure = 
    IF (
        SELECTEDVALUE ( 'Table'[Weekday] ) IN { 6, 7 },
        BLANK (),
        IF (
            SELECTEDVALUE ( 'Table'[Weekday] ) = 1,
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER ( ALL ( 'Table' ), [Date] = ( SELECTEDVALUE ( 'Table'[Date] ) - 3 ) )
            ),
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER ( ALL ( 'Table' ), [Date] = ( SELECTEDVALUE ( 'Table'[Date] ) - 1 ) )
            )
        )
    )

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.