Forum Discussion

sajal161292's avatar
sajal161292
Helper V
8 years ago

Need to extend the data across multiple dates

Hi,

 

 

I am working on a visual in Power BI in which I would like to copy the previous week's quantity to the next week if it does not exists and keep the same values if it exists.

 

As an example in the 1st row there is no quantity against the dates 2/26/2018 and 2/27/2018...so it should be previous week's value(0 0 11359)  i.e. it should retain the Total order type(which is a calculated field) 

Total = Demand + Supply

 

 

Need to create a DAX measure for this functionality.

So could you please tell me a way of achieving it in Power BI?

 

 

Please find the link of my PBI file attached below:

https://drive.google.com/open?id=1cCnbdHqfSGa4q_ktrzcPiYv1dM8GrAZj

3 Replies

  • v-huizhn-msft's avatar
    v-huizhn-msft
    Microsoft Employee

    Hi sajal161292,

    After test, I can not find a way. While there is no quantity against the dates 2/26/2018 and 2/27/2018, it should display the previous week value(0 0 11359), the previous week of 2/26/2018 means from 2/19/2018 to 2/26/2018?

    Best Regards,
    Angelia

    • sajal161292's avatar
      sajal161292
      Helper V

      Hi,

       

      My bad...It should be previous date's data (Total field at the bottom is the sum of Demand and Supply). 

      It should be like:

      Demand  0

      Supply 0

      Total 11359 (in this example).

       

      In case of missing quantitites the Demand and Supply must be zero.

      Total should remain same as that of previous date.

      • sajal161292's avatar
        sajal161292
        Helper V

        Hi,

         

        I am trying to use this dax measure:

         

        Condition Check =
        VAR lastday =
        CALCULATE (
        MAX ( 'Shortages'[Due Date] ),
        FILTER (
        ALL ( 'calendar'[Date] ),
        'calendar'[Date] < MAX ( 'calendar'[Date] )
        ))
        var ordr = SELECTEDVALUE(Shortages[Order type])

        return if(ISBLANK(min(Shortages[Due Date])),
        SWITCH(ordr,"Total",CALCULATE(SUM(Shortages[quantity]),FILTER(all('calendar'),'calendar'[Date]=lastday)),
        " "),SUM(Shortages[quantity]))

         

        But it is not giving me the desired output.

        Can someone please help?