48 - Playing with Summarize and Groupby (Power Pivot)

Опубликовано: 25 Октябрь 2023
на канале: WesleySon
316
2

I wanted to play around with the Summarize and Groupby functions in DAX. Both do the same thing - they group a table. They work differently under the hood, and are used in different cases.
The summary is: Use Addcolumns(Summarize()) when you work with columns that already exist in your table - use Groupby when you work with temporary new columns.

Another thing I keep stressing in the video is: Be clear as to what questions you're trying to answer.
Do you want to see all rows with sales above X?
Only the salespeople with sales above X?
Do you want to know how many rows were above and below X?
Communicate clearly!

This explains clustering aka why you don't use Summarize on calculated columns
https://www.sqlbi.com/articles/all-th...
This explains Currentgroup, and is also where I got the Countx(Currentgroup(), 1) from.
https://dax.guide/currentgroup/


00:00 Intro
00:24 Query 1 - Rows of sales above 1k
00:57 Summarize can add columns. Don't
01:48 Addcolumns
02:43 Filtering a query
04:01 Query 2 - Salespeople who sold 1k+ in at least 1 month
05:29 Summarize vs Groupby
06:09 Using Groupby instead
07:26 Selectcolumns to only return X columns
08:08 Query 3 - Rows above/below a threshold
10:21 Currentgroup
11:48 Playing with the threshold