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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ganesanr1002
Frequent Visitor

I m Trying for the roll back days if the week has end need to start again from day 0

Hi Guys ,

 

This is my Table Structure . Here i'm trying to calculate next Three  days forecasted sales and my days starts at sunday that is 0 , So everyday need to calculate next three days forecasted sales .Here one problem is their if the day number is 4 need to calculate day 5 and 6 forecasted sales , If the day number is 5 need to calculate day 6 , 0, 1 and this calculation need to roll back with in a week .

i can't find any idea can guys help me out 

 

ganesanr1002_0-1683339751296.png

 

1 ACCEPTED SOLUTION

hi @ganesanr1002 

try to add a column like:

Column = 
VAR _date = [date]
VAR _daynumber = [Day Number]
RETURN
SUMX(
    FILTER(
        data,
        WEEKNUM(data[Date])=WEEKNUM(_date)
            &&data[Day Number] IN {MOD(_daynumber+1,7), MOD(_daynumber+2,7), MOD(_daynumber+3,7)}
    ),
    data[Forecasted Sales]
)

it worked like:

FreemanZ_0-1683437012621.png

View solution in original post

6 REPLIES 6
FreemanZ
Super User
Super User

or you plot a table visual with the date column and a measure like:

 

measure = 
VAR _date = MAX(data[date])
RETURN
SUMX(
    FILTER(
        ALL(data),
        data[Date]>_date
            &&data[Date] <=_date+3
    ),
    data[Forecasted Sales]
)

 

it worked like:

FreemanZ_2-1683341951419.png

Hey Thanks for the Reply , Think like we are in the week of 13 so forested sales should not go outside the 13th week , This measure will work for upto 29th March if the 30 th march comes need to calculate 31 st march , 1st April and 26 th march Forecasted sale , if 31st march need to calculate 1st April , 26th March, 27th March Forecasted sale, if 1st April comes need to calculate 26th , 27th,28th march forecasted sales .
I need to roll up days with in a week itself

or try to plot a table visual with the date column and a measure like:

measure = 
VAR _date = MAX(data[date])
VAR _daynumber = MAX(data[Day Number])
RETURN
SUMX(
    FILTER(
        ALL(data),
        WEEKNUM(data[Date])=WEEKNUM(_date)
            &&data[Day Number] IN {MOD(_daynumber+1,7), MOD(_daynumber+2,7), MOD(_daynumber+3,7)}
    ),
    data[Forecasted Sales]
)

it worked like:

FreemanZ_1-1683437080710.png

hi @ganesanr1002 

try to add a column like:

Column = 
VAR _date = [date]
VAR _daynumber = [Day Number]
RETURN
SUMX(
    FILTER(
        data,
        WEEKNUM(data[Date])=WEEKNUM(_date)
            &&data[Day Number] IN {MOD(_daynumber+1,7), MOD(_daynumber+2,7), MOD(_daynumber+3,7)}
    ),
    data[Forecasted Sales]
)

it worked like:

FreemanZ_0-1683437012621.png

Hai, Thanks this works 

FreemanZ
Super User
Super User

hi @ganesanr1002 

try to add a column like:

Column = 
VAR _date = [date]
RETURN
SUMX(
    FILTER(
        data,
        data[Date]>_date
            &&data[Date] <=_date+3
    ),
    data[Forecasted Sales]
)

with a simlified dataset:

FreemanZ_0-1683341847936.png

 

it worked like:

FreemanZ_1-1683341869509.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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