Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to create a new calculated row from previous row

Hi,

 

Can you please help me to achieve the below:

 

I have a below table:

C1C2C3C4
zzzzzIndia01/01/2019250
zzzzzIndia01/02/2019676
zzzzzIndia01/03/201933
zzzzzIndia01/04/20190
zzzzzIndia01/05/201945
zzzzzIndia01/06/2019232
zzzzzIndia01/07/2019122
zzzzzIndia01/08/20196
zzzzzIndia01/09/201945
zzzzzIndia01/10/20191334
zzzzzIndia01/11/2019211
zzzzzIndia01/12/201923

 from the above table , i created the matrix table to display the data as:

  JanuaryFebruaryMarchAprilMayJuneJulyAugestSeptemperOctoberNovemberDecember
zzzzzIndia25067633045232122645133421123

 

but I need to display the data as below:

 

  JanuaryFebruaryMarchAprilMayJuneJulyAugestSeptemperOctoberNovemberDecember
zzzzzIndia25067633045232122645133421123
zzzzzIndia25092670933452773541285113791334211

 

2nd row is the calculated row. if Jan month I need the same data, if Feb then I need the sum of Jan+Feb data. like for all columns. (Previous month + current month)

 

can anyone help me to achieve this please?

 

 

 

6 Replies

  • You need to create a measure this month + last month

     

    MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date Filer])) 
    PMTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date Filer],-1,month))) 
    
    New Sales = MTD Sales +PMTD Sales

     

    Add this to your matrix table

     

    In the matrix table. We have a property under values - Show on rows - Switch that on. You will get a similar display with measure name.

     

    Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
    Thanks.

    My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Lin,

       

      Thank you so much for your solutions. I checked the file you attached and its working as I expected.

      I tried to apply the same logic in my original file and not getting the expected output. I am getting the sum of current month data instead of prev month + current month. for example, Jan month data is 200 and  Feb  is 250 then I am getting 500 instead 450.

      I couldn't able to attach my file here. I checked all the settings in your file and compared with me but I couldn't get what is the issue. can you help me on this pease?

       

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Its working fine now. Thank you.