I'm a beginner with Power Pivot/DAX, and got thinking about that:
Given two tables: items and groups, related by columns [groupid]. I create calculated columns in the groups table. There is more than one way to do it:
A third approach is defining measures in the items table, then use the measures in calculated columns:
Assuming my tables will be large at some time, are there pros and cons?
Given two tables: items and groups, related by columns [groupid]. I create calculated columns in the groups table. There is more than one way to do it:
Code:
groups[n items 1]=COUNTROWS(RELATEDTABLE(items))
groups[max fact 1]=MAXX(RELATEDTABLE(items), items[somefact])
groups[n items 2]=CALCULATE(COUNTROWS(items))
groups[max fact 2]=CALCULATE(MAX(items[somefact]))
Code:
items[n items]:=COUNTROWS()
groups[n items 3]=[n items]
items[max fact]:=MAX(items[somefact])
groups[max fact 3]=[max fact]
Last edited: