powerpivot - DAX Measure with different granularities -
i'm looking how write specific dax measure. here simplified version of data , model:
model:
measures:
total amt:=sum(amounts[amt]) total pos amt:=sumx(amounts, if([amt]<0,0,[amt])) total amt all:=calculate([total pos amt],all(ptr)) total amt 2:=sumx(bridge,calculate([total pos amt],all(ptr))) total amt 3:=sumx(values(bridge[pri]),calculate([total pos amt],all(ptr))) as can see in first pivottable (where [pri] & [ptr] row fields), highlighted cells show values issue. [total pos amt] measure sums [amt] column in amounts table iterating through , evaluating expression negative amounts treated 0 , positive amounts kept. @ [pri] level granularity, want same logic apply (i.e. evaluate expression @ [ptr] level). problem [total amt all] measure on pivottable row [ptr] z under [pri] don't want. measures [total amt 2] , [total amt 3] solve issue subtotals @ [pri] level wrong in [total amt 2] , grand total wrong in [total amt 3].
any appreciated! how can write measure won't show [ptr] not associated [pri] per bridge table, correctly sums [total pos amt] measure @ [pri] level?
so 1 of problems might fields you're using in pivottable. got work using bridge table fields:
totalamtbridged:=calculate ( sumx(amounts, if([amt]<0,0,[amt]) ) , bridge ) finaltotalamt:= calculate([totalamtbridged], all(bridge[ptr]) and pivottable uses bridge[pri] , bridge[ptr]. totalamtbridged forces total amount use bridge context, , finaltotal says ignore ptr (i.e. each row we're displaying figure out total amount bridge[pri] only).
and grand total's doing that, bob's uncle.




Comments
Post a Comment