+ Reply to Thread
Results 1 to 3 of 3

DAX measure using CALCULATETABLE with an measerue

  1. #1
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    620

    DAX measure using CALCULATETABLE with an measerue

    Hi,

    in pbi, i created a straight forward total measure

    Please Login or Register  to view this content.
    I than wrote another

    Please Login or Register  to view this content.
    Which when dropped on a card gives the right answer , but if i use

    Please Login or Register  to view this content.
    , I get the wrong answer ?

    but it's definitely iterating over a filtered table , just not as I would have thought.

    I get 62 , correct, but when use the measure 76 , what's happening, I've attached the excel sheet but it is just a list of a few numbers.

    RD
    Attached Files Attached Files

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: DAX measure using CALCULATETABLE with an measerue

    Hi,

    Using the example file you posted, the part:

    CALCULATETABLE( Table1, Table1[Sales] < 10 )

    will produce the following table:

    Product Sales
    a 8
    b 2
    c 3
    b 7
    c 2
    a 4
    b 6
    c 8
    d 3
    a 3
    d 2
    a 2
    b 7
    c 5

    SUMX then iterates through each row within this table and calculates the value of [Total Sales Measure] for each row. To do this, it filters the original Table1 according to the Product/Sales combination in each row of the above and then sums the resulting rows. For example, for the first row in the above table, you will be filtering the original Table1 for Product="a" and Sales=8, and for each row which matches these criteria you take the sum of the Sales.

    For the vast majority of cases, the paired entries (Product/Sales) in the above table occur just once in Table1, apart from one combination (b|7), which appears twice. As such, each b|7 entry in the above table returns a total of 14, not 7, thus making your overall total 14 greater than that for the equivalent measure but using Table1[Sales] in place of [Total Sales Measure].

    Regards
    Last edited by XOR LX; 07-22-2022 at 10:39 AM.
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    620

    Re: DAX measure using CALCULATETABLE with an measerue

    Well spotted, I thought if might be due to duplicates as I've had the same problem with averagex, I'd actually checked for for duplicates, but I looked at the 'original' not filtered table, and there the duplicates did not make 14 so thought might be something else,
    if I added a unique identifier, eg index I presume the problem would go away.

    RD

+ 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. Pivot Table: Grand Total different measure from Column measure
    By chinneywow in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 08-07-2019, 06:22 AM
  2. DAX Cumulative Measure
    By chicagolarsons in forum Excel General
    Replies: 1
    Last Post: 03-09-2019, 12:45 AM
  3. [SOLVED] How to measure 2 results with an IF
    By jimd1768 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-07-2018, 08:00 AM
  4. [SOLVED] Tolerance measure
    By Noppa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-22-2018, 02:47 AM
  5. PowerPivot measure
    By KriZo in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 11-20-2017, 12:56 PM
  6. [SOLVED] measure one set of coordinates to many
    By lexi521 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-22-2013, 10:53 AM
  7. Excel 2007 : need help - desperate measure...
    By giampo in forum Excel General
    Replies: 1
    Last Post: 08-21-2009, 05:44 PM

Tags for this Thread

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