Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Compare Column with previous row and repeat the loop

Hi Team,

 

Please find the data below ,need to create a new measure which will show 

1)same as orders if the date is start of month

2)compare the month start with previous row from orders.

 

Commens column in screenshot has the formula for the calculation

 

 

  • Hi Anonymous 

     

    Please find the below measure for your reference.

     

    a1 = CALCULATE(SUM(Sheet1[Amount]), PREVIOUSDAY(Sheet1[DD]))  
     
    sales = SUM(Sheet1[Amount])
     
    a2 = [sales]-[a1]

     

    Thanks

4 Replies

  • davehus's avatar
    davehus
    Icon for Memorable Member rankMemorable Member

    Hi Anonymous ,

     

    Please see attached solution, most of the steps are done in power query. Hopefully it helps.

     

    Did I help you today? Please accept my solution and hit the Kudos button.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi davehus ,the expected output is different from what is shared by you.

      Need this to be resolved in Dax not in Power Query.

      In your example ,displaying previous row value.

      But in my requirtment current date order to be minus with previous day output.Please refer the screenshot above for reference.

      • Shreeram04's avatar
        Shreeram04
        Icon for Resolver III rankResolver III

        Hi Anonymous 

         

        Please find the below measure for your reference.

         

        a1 = CALCULATE(SUM(Sheet1[Amount]), PREVIOUSDAY(Sheet1[DD]))  
         
        sales = SUM(Sheet1[Amount])
         
        a2 = [sales]-[a1]

         

        Thanks