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
SimplesHoT89
Frequent Visitor

Move data from Weekend to Friday

Hi guys,

 

I have a quite simple data table with the following issue. (date column and then a column for each product)

The data shows the production numbers on a daily basis, however some saturdays have values as well and I want to move the data from all Saturdays to the weekday before, therefore Friday because it's messing up my daily average. I'm struggling to find the right function so any help is appreciated.

SimplesHoT89_1-1655808531704.png

 

SimplesHoT89_0-1655808327477.png

 

Thanks!

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @SimplesHoT89 ,

I have created a simple sample, please refer to it to see if it helps you.

Create three columns (must use columns).

ALLVALUE =
'Table'[A] + 'Table'[B] + 'Table'[C] + 'Table'[D] + 'Table'[E] + 'Table'[F]
WEEKDAY = WEEKDAY('Table'[date],2)
WEEKNO = WEEKNUM('Table'[date],2)

Then the result column you can use a measure or a column.

A measure.

Me =
VAR _WEEKEND =
    CALCULATE (
        SUM ( 'Table'[ALLVALUE] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[WEEKNO] = SELECTEDVALUE ( 'Table'[WEEKNO] )
                && 'Table'[WEEKDAY] >= 6
        )
    )
VAR _VALUE =
    CALCULATE (
        MAX ( 'Table'[ALLVALUE] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[WEEKDAY] = 5
                && 'Table'[WEEKNO] = SELECTEDVALUE ( 'Table'[WEEKNO] )
        )
    )
RETURN
    IF (
        MAX ( 'Table'[WEEKDAY] ) = 5,
        _VALUE + _WEEKEND,
        IF ( MAX ( 'Table'[WEEKDAY] ) >= 6, BLANK (), MAX ( 'Table'[ALLVALUE] ) )
    )

 A column.

Me_COLUN =
VAR _WEEKEND =
    CALCULATE (
        SUM ( 'Table'[ALLVALUE] ),
        FILTER (
            ( 'Table' ),
            'Table'[WEEKNO] = EARLIER ( 'Table'[WEEKNO] )
                && 'Table'[WEEKDAY] >= 6
        )
    )
VAR _VALUE =
    CALCULATE (
        SUM ( 'Table'[ALLVALUE] ),
        FILTER (
            ( 'Table' ),
            'Table'[WEEKDAY] = 5
                && 'Table'[WEEKNO] = EARLIER ( 'Table'[WEEKNO] )
        )
    )
RETURN
    IF (
        ( 'Table'[WEEKDAY] ) = 5,
        _VALUE + _WEEKEND,
        IF ( ( 'Table'[WEEKDAY] ) >= 6, BLANK (), ( 'Table'[ALLVALUE] ) )
    )

vpollymsft_0-1656037767861.png

If I have misunderstood your meaning, please provide more details with your desired output.

 

Best Regards

Community Support Team _ Polly

 

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

View solution in original post

2 REPLIES 2
v-rongtiep-msft
Community Support
Community Support

Hi @SimplesHoT89 ,

I have created a simple sample, please refer to it to see if it helps you.

Create three columns (must use columns).

ALLVALUE =
'Table'[A] + 'Table'[B] + 'Table'[C] + 'Table'[D] + 'Table'[E] + 'Table'[F]
WEEKDAY = WEEKDAY('Table'[date],2)
WEEKNO = WEEKNUM('Table'[date],2)

Then the result column you can use a measure or a column.

A measure.

Me =
VAR _WEEKEND =
    CALCULATE (
        SUM ( 'Table'[ALLVALUE] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[WEEKNO] = SELECTEDVALUE ( 'Table'[WEEKNO] )
                && 'Table'[WEEKDAY] >= 6
        )
    )
VAR _VALUE =
    CALCULATE (
        MAX ( 'Table'[ALLVALUE] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[WEEKDAY] = 5
                && 'Table'[WEEKNO] = SELECTEDVALUE ( 'Table'[WEEKNO] )
        )
    )
RETURN
    IF (
        MAX ( 'Table'[WEEKDAY] ) = 5,
        _VALUE + _WEEKEND,
        IF ( MAX ( 'Table'[WEEKDAY] ) >= 6, BLANK (), MAX ( 'Table'[ALLVALUE] ) )
    )

 A column.

Me_COLUN =
VAR _WEEKEND =
    CALCULATE (
        SUM ( 'Table'[ALLVALUE] ),
        FILTER (
            ( 'Table' ),
            'Table'[WEEKNO] = EARLIER ( 'Table'[WEEKNO] )
                && 'Table'[WEEKDAY] >= 6
        )
    )
VAR _VALUE =
    CALCULATE (
        SUM ( 'Table'[ALLVALUE] ),
        FILTER (
            ( 'Table' ),
            'Table'[WEEKDAY] = 5
                && 'Table'[WEEKNO] = EARLIER ( 'Table'[WEEKNO] )
        )
    )
RETURN
    IF (
        ( 'Table'[WEEKDAY] ) = 5,
        _VALUE + _WEEKEND,
        IF ( ( 'Table'[WEEKDAY] ) >= 6, BLANK (), ( 'Table'[ALLVALUE] ) )
    )

vpollymsft_0-1656037767861.png

If I have misunderstood your meaning, please provide more details with your desired output.

 

Best Regards

Community Support Team _ Polly

 

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

Hi @v-rongtiep-msft,

 

thanks for the answer. My second Screenshot was maybe a bit misleading to be fair. I do need the values from the weekend to be added to the total of the product (therefore in your example column A, B,...)  But i can simply adjust what you've posted.

 

Thanks a lot!

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.