+ Reply to Thread
Results 1 to 2 of 2

Power pivot, summarising a calculated field (Volume, rate, mix)

  1. #1
    Registered User
    Join Date
    04-26-2019
    Location
    Cov,UK
    MS-Off Ver
    2013
    Posts
    1

    Power pivot, summarising a calculated field (Volume, rate, mix)

    This is the first time I've had to use dax formulas and I've only been playing around with them for a day so am a complete novice so please bear that in mind....

    I'm trying to do volume, rate, mix calculation in power pivot rather than just straight excel (Excel 2013).

    I have a calculated field in a pivot table

    Mix=iferror((sum([Sales])-((sum([Sales Forecast])*(1+calculate([Sales vs Versus %],ALLSELECTED(Range))))))*([Profit % Forecast]-calculate([Profit % Forecast],ALLSELECTED(Range))),0)

    This is calculating beautifully except on the sub totals. For these I need it to sum the output, rather than calculating the formula itself.

    The data is summarised at various different levels and has filters applied but simplified below is what I'd expect.


    DAX.png


    We've tried numerous ways. One that was suggested

    Mix2=SUMX(VALUES(Range[Product Level 2]), [Mix])


    is doing something.......but no idea what as it doesn't balance to either number.

    Any help you can give would be greatly appreciated...

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,877

    Re: Power pivot, summarising a calculated field (Volume, rate, mix)

    Without seeing your model hard to help you...

    However, for subtotal/grand total calculation. You'd need special handling.

    1. Use SUMX(Table, Expression) to calculate. This is iterator function and will evaluate your [Mix] calculation for each row of the table.
    Do note that this can be expensive calculation depending on your model.

    2. Use IF(HasOneValue(TableName[Product Level 2]),[Mix],SpecialCalculation)
    For this, you will need to construct another [Mix] calculation ignoring [Product Level 2] filter context for subtotal.

    However, above likely works only with DAX2.0 and I'm not sure what Excel 2013 uses. If above fails, try COUNTROWS(DISTINCT()) instead.
    See link for more detail.
    https://powerpivotpro.com/2012/03/su...-up-correctly/
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Add Calculated Field from Power Pivot
    By kyingh in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 04-11-2019, 01:52 AM
  2. [SOLVED] Store Power Query table and add calculated field
    By jaryszek in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 02-01-2019, 08:18 AM
  3. Replies: 0
    Last Post: 08-15-2016, 02:07 PM
  4. Error in power pivot calculated field
    By stephme55 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-27-2016, 01:42 PM
  5. adding a calculated field to power pivot data model
    By stephme55 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-26-2016, 07:13 PM
  6. Replies: 0
    Last Post: 06-26-2012, 09:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1