+ Reply to Thread
Results 1 to 4 of 4

Aggregate by ID in DAX

  1. #1
    Registered User
    Join Date
    09-06-2012
    Location
    London, UK
    MS-Off Ver
    Excel 2016
    Posts
    2

    Aggregate by ID in DAX

    Hi

    First time post - I couldn't see a DAX thread? I've been using Powerpivot for years but normally I create measures in the source data before Excel & have more normalized data through ETL process, but this isn't possible in this case.

    I want to create a measure in DAX that allows me to group by a parent id & perform calculations / aggregation between rows when grouped.
    For example, with the data below; What is the average time between a case being opened & closed?


    Many Thanks in advance for any help!

    case_id datetime status
    1 1/2/2017 1:23:00 PM opened
    1 1/2/2017 2:00:00 PM esclated
    1 1/2/2017 2:00:00 PM closed
    2 1/3/2017 11:00:00 AM opened
    2 1/3/2017 11:15:00 AM esclated
    2 1/3/2017 11:45:00 AM replied
    2 1/3/2017 5:00:00 PM closed
    3 1/3/2017 3:00:00 PM opened
    3 1/3/2017 3:26:00 PM esclated
    3 1/3/2017 3:39:00 PM closed
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Aggregate by ID in DAX

    Hi JB,

    I'm not a DAX guy but see if the attached does what you need.

    Pivot Helper to Average Time from Open to Close.xlsx

    I'd like to try to get your answer using M, but the attached Pivot might be ok for what you need.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    09-06-2012
    Location
    London, UK
    MS-Off Ver
    Excel 2016
    Posts
    2

    Re: Aggregate by ID in DAX

    Hi Marvin,

    Thanks for your quick response!

    Yeah, I can do it for single dataset using a pivot / standard excel functions. However I'm trying to build this for an auto-increment data set in a report where users aren't able to edit/update the formulae themselves.

    So my current solution is similar to what you have suggested - using a pivot on a hidden sheet to group by the id & then measures which calc the first open & last close dates & the difference between.

    However this seems fairly inelegant & I'm not sure how well the performance will stand up when there's a few 100,000 rows. I'm fairly certain you can use the GROUPBY / SUMMARIZE / ADDCOLUMNS DAX functions to create this as a single measure but haven't been able to find a decent example yet.

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Aggregate by ID in DAX

    Maybe group in PQ then use in Data Model with PP measures

    it's only idea

+ 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. Aggregate error
    By giscosta_br in forum Excel General
    Replies: 1
    Last Post: 05-24-2016, 07:46 AM
  2. [SOLVED] AGGREGATE Function
    By chief_abound in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-03-2015, 12:48 AM
  3. Aggregate Function Using Sum
    By gtbaseball7 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-01-2015, 02:19 PM
  4. [SOLVED] Aggregate Formulas
    By excel girl in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-26-2014, 11:09 AM
  5. Aggregate Function
    By nav505 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-04-2013, 03:20 AM
  6. [SOLVED] Aggregate forumla help
    By seanyc in forum Excel General
    Replies: 13
    Last Post: 06-15-2012, 02:42 PM
  7. Best way to aggregate?
    By gnome_core in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2009, 04:38 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