Forum Discussion

escalas's avatar
escalas
Frequent Visitor
9 years ago
Solved

Sum weekend values on monday

Hi,   I need to sum the 'SR totales' values on weekends to the value on mondays. Saturday and Sunday are 03/06/2017 and 04/06/2017.  Do you have any idea of how it can be done ?  Thanks in advanc...
  • MFelix's avatar
    9 years ago

    Hi escalas,

     

    Created a small table with date and value, created a calculated measure with the following formula:

     

    Value Weekend = 
    VAR Current_day =
       MIN (Table1[Date])
    VAR Saturday =
        MIN ( Table1[Date] ) - 2
    RETURN
        IF (
           WEEKDAY( Current_day ) = 1
                || WEEKDAY( Current_day ) = 7,
            BLANK (),
            IF (
                WEEKDAY(Current_day) = 2,
                CALCULATE (
                    SUM ( Table1[Values] ),
                    FILTER (
                        ALL ( Table1 ),
                        Table1[Date] >= saturday
                            && Table1[Date] <= Current_day
                    )
                ),
                SUM ( Table1[Values] )
            )
        )

    The result is below please check if it is ok.

     

    The first image is the detailed values and the second one is just using the measure if you need to "hide2 the weekend.

     

    Regards,

    MFelix