Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Selected Week from Next 4 week value calculation

I have table name called Invenoty sheet . this table look like . i want filter it only Demand Attribute value . if Demand attribute value if date 15 March  2021 select from that date to Next week  value  Need to get it for 15 March 2021.

 

I am Used below Measure 

Mesaure  = CALCULATE(sum(Append1[Value]),FILTER(Append1,Append1[Attributes]="Demand"),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),1,MONTH))  

 

( 4  week Consider as 1 week ) 

INPUT:

 

DATE                           ATTRIBUTE                         value                      

15 March 2021            Demand                               45

15 March 2021            DOI                                      25

22 March 2021           Demand                                55

22 March 2021            DOI                                      35

29 March 2021            Demand                               65

29 March 2021            DOI                                       85

05 April   2021            Demand                               45

05 April   2021            DOI                                       85

12 April  2021           Demand                                  95

12 April  2021              DOI                                     65

19 April  2021            Demand                               45

19 April  2021            DOI                                      35

26 April  2021            Demand                               45

26 April  2021            DOI                                      65

 

 

Expected Output : 

 

DATE                           ATTRIBUTE                         value           Selected week from Next 4 week

15 March 2021            Demand                              15                         120                                             =>    15+25+35+45

22 March 2021           Demand                               25                         170                                             =>   25+35+45+55

29 March 2021            Demand                              35                         190                                             =>  35+45+55+65

05 April   2021            Demand                              45                          210                                            =>45+55+65+45

------

----

----------

31 December 2022   Demand                               88

 

Looking for support .. thanks in advance .,

  • Hi Anonymous ,

     

    1.Please create a new table like below using following DAX:

    Table = FILTER('Append1','Append1'[ATTRIBUTE]="Demand")

     

    2.Create a measure called Selected week from Next 4 week:

    Selected week from Next 4 week = SUMX(
        DATESINPERIOD('Table'[DATE],MIN('Table'[DATE]),28,DAY),
        CALCULATE(SUM('Table'[VALUE]))
    )

     

    3.In report page, please create a table visual, then you can see the total data for the last four weeks.

    210 = 45+55+65+45

    260 = 55+65+45+95

    250 = 65+45+95+45

    ……

    Best Regards,

    Yadong Fang

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

2 Replies

  • v-yadongf-msft's avatar
    v-yadongf-msft
    Community Support

    Hi Anonymous ,

     

    1.Please create a new table like below using following DAX:

    Table = FILTER('Append1','Append1'[ATTRIBUTE]="Demand")

     

    2.Create a measure called Selected week from Next 4 week:

    Selected week from Next 4 week = SUMX(
        DATESINPERIOD('Table'[DATE],MIN('Table'[DATE]),28,DAY),
        CALCULATE(SUM('Table'[VALUE]))
    )

     

    3.In report page, please create a table visual, then you can see the total data for the last four weeks.

    210 = 45+55+65+45

    260 = 55+65+45+95

    250 = 65+45+95+45

    ……

    Best Regards,

    Yadong Fang

    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
      Not applicable

      v-yadongf-msft   tank you its working. is there any possible to show Week Wise ..

       

      My data set looks like a below