Forum Discussion
Anonymous
7 years agoNot applicable
partial month calculation
year month amount year month amount 2017 1 1000 2017 1 1000 2017 2 3000 2017 2 2000 2017 3 7000 wanted result-> 2017 3 4000 2017 ...
- 7 years ago
Hi Anonymous,
Maybe you could try to modify the formula as below:
Column = VAR a = 'Table1'[month] - 1 RETURN [amount] - CALCULATE ( SUM ( Table1[amount] ), FILTER ( 'Table1', 'Table1'[month] = a && 'Table1'[year] = EARLIER ( Table1[year] ) && 'Table1'[code] = EARLIER ( Table1[code] ) && 'Table1'[company] = "dk" ) )Regards,
Daniel He
v-danhe-msft
7 years agoMicrosoft Employee
Hi Anonymous,
You could modify my former formula as below:
Column = var a='Table1'[month]-1
return [amount]-CALCULATE(SUM(Table1[amount]),FILTER('Table1','Table1'[month]=a&&'Table1'[year]=EARLIER(Table1[year])&&'Table1'[code]=EARLIER(Table1[code])))
Result:
Regards,
Daniel He
Anonymous
7 years agoNot applicable
Column = var a='UploadAccounts'[Month]-1
return [-amount]-CALCULATE(SUM(UploadAccounts[-amount]),FILTER('UploadAccounts','UploadAccounts'[Month]=a&&'UploadAccounts'[Year]=EARLIER(UploadAccounts[Year])&&'UploadAccounts'[AccountCode]=EARLIER(UploadAccounts[AccountCode])))
code so applied its not working, it give as output strange result
example jannuar
1000
it turn february 2000
it doest make sum february-januar
just moltiply 2
check the screen
- v-danhe-msft7 years agoMicrosoft Employee
Hi Anonymous,
Could you have downloaded my pbix file to have a view? All the data I used is given from your last post, if it is still incorrect, could you please upload your pbix file to OneDrive or Dropbox and send the link here to let me have a test?
Regards,
Daniel He
- Anonymous7 years agoNot applicable
maybe i find out why is not working in the table are many company with same month code year so maybe addiing a condition for same compnay will fix everything .. how i can add this contition?
year month amount code company year month amount code company 2017 1 1000 101 dk 2017 1 1000 101 dk 2017 2 3000 101 dk 2017 2 2000 101 dk 2017 3 7000 101 dk wanted result-> 2017 3 4000 101 dk 2017 4 10000 101 dk 2017 4 3000 101 dk 2017 5 14000 101 dk 2017 5 4000 101 dk 2017 6 18000 101 dk 2017 6 4000 101 dk 2017 7 25000 101 dk 2017 7 7000 101 dk 2017 8 30000 101 dk 2017 8 5000 101 dk 2017 9 40000 101 dk 2017 9 10000 101 dk 2017 10 75000 101 dk 2017 10 35000 101 dk 2017 11 95000 101 dk 2017 11 20000 101 dk 2017 12 100000 101 dk 2017 12 5000 101 dk 2018 1 2000 101 dk 2018 1 2000 101 dk 2018 2 3000 101 dk 2018 2 1000 101 dk 2018 3 5000 101 dk 2018 3 2000 101 dk 2018 4 7000 101 dk 2018 4 2000 101 dk 2018 5 10000 101 dk 2018 5 3000 101 dk 2018 6 12000 101 dk 2018 6 2000 101 dk 2018 7 15000 101 dk 2018 7 5000 101 dk 2018 8 19000 101 dk 2018 8 4000 101 dk 2018 9 30000 101 dk 2018 9 11000 101 dk 2018 10 40000 101 dk 2018 10 10000 101 dk 2018 11 45000 101 dk 2018 11 5000 101 dk 2018 12 50000 101 dk 2018 12 5000 101 dk 2017 1 1000 102 dk 2017 1 1000 102 dk 2017 2 3000 102 dk 2017 2 2000 102 dk 2017 3 7000 102 dk wanted result-> 2017 3 4000 102 dk 2017 4 10000 102 dk 2017 4 3000 102 dk 2017 5 14000 102 dk 2017 5 4000 102 dk 2017 6 18000 102 dk 2017 6 4000 102 dk 2017 7 25000 102 dk 2017 7 7000 102 dk 2017 8 30000 102 dk 2017 8 5000 102 dk 2017 9 40000 102 dk 2017 9 10000 102 dk 2017 10 75000 102 dk 2017 10 35000 102 dk 2017 11 95000 102 dk 2017 11 20000 102 dk 2017 12 100000 102 dk 2017 12 5000 102 dk 2018 1 2000 102 dk 2018 1 2000 102 dk 2018 2 3000 102 dk 2018 2 1000 102 dk 2018 3 5000 102 dk 2018 3 2000 102 dk 2018 4 7000 102 dk 2018 4 2000 102 dk 2018 5 10000 102 dk 2018 5 3000 102 dk 2018 6 12000 102 dk 2018 6 2000 102 dk 2018 7 15000 102 dk 2018 7 5000 102 dk 2018 8 19000 102 dk 2018 8 4000 102 dk 2018 9 30000 102 dk 2018 9 11000 102 dk 2018 10 40000 102 dk 2018 10 10000 102 dk 2018 11 45000 102 dk 2018 11 5000 102 dk 2018 12 50000 102 dk 2018 12 5000 102 dk - v-danhe-msft7 years agoMicrosoft Employee
Hi Anonymous,
Maybe you could try to modify the formula as below:
Column = VAR a = 'Table1'[month] - 1 RETURN [amount] - CALCULATE ( SUM ( Table1[amount] ), FILTER ( 'Table1', 'Table1'[month] = a && 'Table1'[year] = EARLIER ( Table1[year] ) && 'Table1'[code] = EARLIER ( Table1[code] ) && 'Table1'[company] = "dk" ) )Regards,
Daniel He