• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to Calculate Sum and Average in Power Pivot Data Model

happy1001

New Member
Hello

I have got stock market data in a Table, which I want to import inside Power Pivot Data Model and then create some new columns.

I have prepared a very small sample excel file. The real data is quite large in size. And I have also prepared a very SIMPLE Example for learning the method of how we can calculate CHANGE and PERCENTAGE CHANGE COLUMNS inside PP Data Model.

Once these 2 new columns are calculaed, then I also want to calculate these 4 new columns as well, if that is not very hard to do -

Past 2 Day Sum of ClosePrice
Past 3 Day Sum of ClosePrice
Past 2 Day Average of ClosePrice
Past 3 Day Average of ClosePrice

I have attached the excel file that has got -
Source Data Table
Expected Data Table
and the data has been imported into the Data Model.

I do not have any experience in dealing with Data Models yet. Please suggest how we can get the desired output inside Data Model. I am not completely sure, if such calculations can be done inside Data Model or not, but I think it should be possible, either directly or by using some complex DAX Codes etc.

I am using the following software versions -
Microsoft SQL Server Management Studio version- 12.0.2000.8,
Microsoft Office Professional Plus 2016 x64
and Windows 7 x64

Thanks a lot for any help.

Regards
Source Data.png Expected Result.png
 

Attachments

  • Change And Percentage Change.xlsx
    119.2 KB · Views: 7
Back
Top