Working w/Virtual In-Memory Tables in Power BI using DAX


#1

#2

Hi Sam, I’d just like to check my understanding of the DAX formula for Overall Ranking Factor in this video. What type of values are assigned to the variables? Are they tables or scalar values?


#3

The variables in this example would be considered scalar.

This is because of what context they are in. In the customer context they are all working out to be one results for each row.

Then within the actual formula they are evaluating at each row.


#4

virtual_tables

so, SUMMARIZE provides SUMX with a table to iterate over but how does it have more than one row in it? Sorry, if I’m being dense about this but these mechanisms are puzzling me.


#5

It all depends on the initial context in this particular example (this is a very important concept for anything with DAX)

Because the initial context is customers then the SUMMARIZE is being filtered at each different results by the customer. The variable then do there work for every singular customer.

This video review summarize

Table functions generally are also something good to review for understanding this.

Chrs


#6

I think I get this now:

The initial context is one customer. The rank for Sales, Profit, and Margin is assigned to the appropriate variable for this customer. We need to add these values together to get the overall ranking. We have to use SUMX for this and SUMX requires a table over which to iterate.

SUMMARIZE produces a one row table grouped on the customer in the initial context with the rank values from the variables passed to it.

The output values from SUMMARIZE [Sales Rank] [Profit Rank] [Margin Rank] are added in the second argument of SUMX and returned to the caller.


#7

Exactly, that’s right. Nice one.


#8

Great! The thing that was confusing me was my assumption that the table SUMMARIZE produced would have multiple rows. I think that assumption came from my concept of iteration (which implies multiple rows).

Thanks Sam


#9

Yes it is a mind bending when first getting into these, but become easier after completing a few.


#10

This was my thought process also, but this great conversation really helps me to better understand this concept. Thank you both.