Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Weekend values on Monday

Hi, I checked other topics but without success. I need to add weekend values (sobota - Saturday and niedziela - Sunday) on Mondays (poniedzialek). Any ideas? BR, Jarek
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous 

    In addition to 

    Weekend values on Monday = 
    IF (
        HASONEVALUE ( 'Table'[Date] ),
        IF (
            MAX ( 'Table'[WeekDay] ) IN { 5, 6 },
            BLANK (),
            IF (
                MAX ( 'Table'[WeekDay] ) = 0,
                SUMX (
                    FILTER (
                        ALL ( 'Table' ),
                        'Table'[Date]
                            >= MAX ( 'Table'[Date] ) - 2
                            && 'Table'[Date] <= MAX ( 'Table'[Date] )
                    ),
                    'Table'[Total _Orders]
                ),
                SUM ( 'Table'[Total _Orders] )
            )
        ),
        SUM ( 'Table'[Total _Orders] )
    )

    Result is as below.

    You can download the pbix file from this link: Weekend values on Monday

     

    Best Regards,

    Rico Zhou

     

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

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous 

    Due to your first visual is table visual and second is matrix visual, so you can build a new measure for matirx visual.

    My new sample table:

    Measures:

    Table.Monday value Measure = 
    IF (
            MAX ( 'Table'[WeekDay] ) IN { 5, 6 },
            BLANK (),
            IF (
                MAX ( 'Table'[WeekDay] ) = 0,
                SUMX (
                    FILTER (
                        ALL ( 'Table' ),
                        'Table'[Date]
                            >= MAX ( 'Table'[Date] ) - 2
                            && 'Table'[Date] <= MAX ( 'Table'[Date] )
                    ),
                    'Table'[Total_Orders]
                ),
                SUM ( 'Table'[Total_Orders] )
            )
        )
    Table.Weekend values on Monday = 
    IF (
        HASONEVALUE ( 'Table'[Date] ),
        'Table'[Table.Monday value Measure],
        SUMX (
            SUMMARIZE ( 'Table', 'Table'[Date], "Value", [Table.Monday value Measure] ),
            [Value]
        )
    )
    Matrix.Monday value Measure = 
        IF (
            MAX ( 'Table'[WeekDay] ) IN { 5, 6 },
            BLANK (),
            IF (
                MAX ( 'Table'[WeekDay] ) = 0,
                SUMX (
                    FILTER (
                        ALL ( 'Table' ),
                        'Table'[Date]
                            >= MAX ( 'Table'[Date] ) - 2
                            && 'Table'[Date] <= MAX ( 'Table'[Date] )
                            &&'Table'[User] = MAX('Table'[User])
                    ),
                    'Table'[Total_Orders]
                ),
                SUM ( 'Table'[Total_Orders] )
            )
        )
    Matrix.Weekend values on Monday = SUMX('Table',[Matrix.Monday value Measure])

    Result is as below.

    You can download the pbix file from this link: Weekend values on Monday

     

    Best Regards,

    Rico Zhou

     

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

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous 

    I update your Matrix.Weekend values on Monday Measure.

    Matrix.Weekend values on Monday = 
    VAR _T = SUMMARIZE('Table','Table'[User],'Table'[Date],"Value",[Matrix.Monday value Measure])
    Return
    SUMX(_T,[Value])

    Result is as below:

    Best Regards,

    Rico Zhou

     

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