Create a new table based on some conditions

Hi all,

I’ve a table like this:
table

second column is the customer ID,
third column description
fourth column spend time

I need to obtain a new table with one row for each day, id, description, max(spend time)

I tried to use GROUP BY and partially worked, but I wasn´t able to show the description corresponding to the max time.

I’m newbie on DAX and already tried to found a solution on the internet, but I wasn’t able to

Thanks

@JoaoMonteiro,

SUMMARIZE() will do the trick here. This scenario is exactly what it was designed to do.

  • Brian

Hi @JoaoMonteiro, Have a look at SUMMARIZE: https://info.enterprisedna.co/dax-function-guide/summarize/

The SUMMARIZE function (DAX) returns a summary table for the requested totals over a set of groups.

@BrianJ

I’m sorry but I wasn´t able to get there.

@JoaoMonteiro,

OK, thanks for the clarification - that will require an ADDCOLUMNS(SUMMARIZE() ) structure with an additional measure.

If you can please post your PBIX file, that will make crafting the specific solution easier.

Thanks.

  • Brian

@BrianJ

Hi Brian,
I´m sending the PBIX file.
DAX is tricky.
At beginning seems easy but it has some aspects that I believe that only time and experience allow to overcame.Schedule data model.pbix (445.6 KB)

@JoaoMonteiro,

Thanks, but I think something went sideways with your PBIX file. When I downloaded it, this is what I got, with a message that pending PQ steps had not been applied:

If you can please remedy and repost, I should be able to get a solution back to you quickly.

With regard to DAX, I think you’re spot on. If you haven’t read it yet, I think this article will really resonate with you:

Also, I’ve got a video coming out later this week on the Enterprise DNA TV YouTube channel with some very specific DAX and M practice strategies and tools that hopefully you’ll find helpful too.

  • Brian

Hi @JoaoMonteiro, a response on this post has been tagged as “Solution”. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box. Also, we’ve recently launched the Enterprise DNA Forum User Experience Survey, please feel free to answer it and give your insights on how we can further improve the Support forum. Thanks!