Powerpivot adding calculated item to a field

后端 未结 1 567
有刺的猬
有刺的猬 2020-12-20 06:18

I have data in a table stored in an Excel file. I linked this table into a PowerPivot Data Model, and from that Data Model I want to create a Pivot in the same Excel file.

相关标签:
1条回答
  • 2020-12-20 06:47

    Guenh, this should be quite straightforward:

    Depending on your PowerPivot versions, you either create a new measure from PowerPivot ribbon (Excel 2010 Add-in: New Measure button). In Excel 2013, it was renamed to Calculated Field, still available via PowerPivot ribbon:

    enter image description here

    Anyway, I downloaded your data and created new measures (= calculated fields) for all of your columns, which was the key. The way your data is structured is not ideal, but it's certainly doable. First you have to sum the amount for each category, so use this simple CALCULATE formula:

    -CALCULATE(SUM([Amount]),Table1[Category]="Budget")
    

    What it does is that it sums the amount values, but only for rows have Budget in the Category column. The example above is defined for the Budget category; include the other three categories as well (simply duplicate the formula and change the second parameter in CALCULATE: instead of "Budget", use "Last Year", etc.

    Then create your FoF and YoY calculations by simply using already created measures:

    enter image description here

    If you then add new PivotTable (from PowerPivot window), simply drag Client Name to rows section and all the measures to Values section.

    With that, you should get your desired result table as shows below. Here you can download the source file (for Excel 2013).

    Hope this helps :)

    enter image description here

    0 讨论(0)
提交回复
热议问题