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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Taking three Months Demand value form start week date

 I have the table name called Inventory  sheet . this table   sample data looks like below 

 

Version      Attribute      Value         Weekstartdate

 

pods         Demand         10            15  March  2021 

pods         DOI                20             14 November 2021 

pods         Demand         50            22 March 2021 

pods          DOI                40            21 November 2021 

pods         Demand         30            29 March 2021 

pods         Demand         50            05  April 2021 

pods         Demand         60            12  April 2021 

pods         DOI                10             28 November 2021 

pods         Demand         90            19 April 2021 

pods         Demand         10            26 April 2021 

 


I am trying to  get demand value from selected date to next three Months. i have  tired below measures

 

3 months total demand = CALCULATE([3 months total values],FILTER(Append1, Append1[Attributes]="Demand"))
 
 
3 months total values =
VAR LastDate_ = LASTDATE(Append1[Week Start date])
RETURN
    CALCULATE(
        SUM(Append1[Value]),
        DATESINPERIOD(Append1[Week Start date], LastDate_, 3, MONTH)
    )

 

But iam not getting correct value .  also attached  pbi  fILE ALSO  

Sample File : Sample Power bi  

 

Thanks in advance . 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

1.Please to create a successive date table by “Append” table, and create a model

Calendar =
CALENDAR (
    FIRSTDATE ( 'Append'[Weekstartdate] ),
    LASTDATE ( 'Append'[Weekstartdate] )
)

vbinbinyumsft_0-1659519658075.png

vbinbinyumsft_2-1659519683371.png

 

2.Create two measure

Measure =
VAR cur_date =
    SELECTEDVALUE ( 'Calendar'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Append'[Value] ),
        DATESINPERIOD ( 'Calendar'[Date], cur_date, 3, MONTH )
    )
Measure2 =
VAR cur_ste =
    SELECTEDVALUE ( 'Append'[Attribute] )
RETURN
    IF (
        cur_ste = "Demand",
        CALCULATE ( [Measure], 'Append'[Attribute] = "Demand" )
    )

Add a table visual:

vbinbinyumsft_3-1659519817546.png

Please refer attached .pbix file

 

Best regards,
Community Support Team_ Binbin Yu
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

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

1.Please to create a successive date table by “Append” table, and create a model

Calendar =
CALENDAR (
    FIRSTDATE ( 'Append'[Weekstartdate] ),
    LASTDATE ( 'Append'[Weekstartdate] )
)

vbinbinyumsft_0-1659519658075.png

vbinbinyumsft_2-1659519683371.png

 

2.Create two measure

Measure =
VAR cur_date =
    SELECTEDVALUE ( 'Calendar'[Date] )
RETURN
    CALCULATE (
        SUM ( 'Append'[Value] ),
        DATESINPERIOD ( 'Calendar'[Date], cur_date, 3, MONTH )
    )
Measure2 =
VAR cur_ste =
    SELECTEDVALUE ( 'Append'[Attribute] )
RETURN
    IF (
        cur_ste = "Demand",
        CALCULATE ( [Measure], 'Append'[Attribute] = "Demand" )
    )

Add a table visual:

vbinbinyumsft_3-1659519817546.png

Please refer attached .pbix file

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@Anonymous  Thank  you so much its working  

Anonymous
Not applicable

@amitchandak  sir  I have created Date table and also created new measure but values not getting correctly . please find the created measure below

 

Date = ADDCOLUMNS(CALENDAR(DATE(2020,1,1),DATE(2025,12,31)),"Dateasinteger",FORMAT([Date],"YYYYMMDD"),"YEAR",YEAR([Date]))
 
Rolling 3 = CALCULATE(sum(Append1[Value]),FILTER(Append1,Append1[Attributes]="Demand"),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),3,MONTH))
 
THENNA_41_0-1659416954522.png

 

amitchandak
Super User
Super User

@Anonymous , Please use date table and try

 

example

Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),3,MONTH))

 

 

and why there is no demand filter in the second measure

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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