Tabular DAX Daily Many To Many Association -
i @ end of tether on problem have in model currently... basically, have 'temporal' many many mapping table maps commission rates managers on time... these can change daily, (but rarely), i've tried avoid having huge table same values repeated albeit different specific dates, if anyway end 200 million record table, crucially though more 1 manager can commission sale of product type :s
note: some commissions go single manager, , go multiple, , can switch on time..
what i've done instead hold validfrom, , validto dates in mapping table...
every solution come deathly slow, , have no idea if there solution @ point... here link small sample:- http://1drv.ms/1gor7uw
the area think troublesome getting correct "rate" given manager, on given day... way can seem able nested sumx, there must slicker i'm missing?!
one thing thought (but failed implement) hold effective date, , filter using , leverage lastnonblank() or something?
perhaps fresh eyes can me out? pulling hair out here!
edit: why don't in etl, i've not shown here have other measures don't need split managers, instead full amount should reported each... total not sum of managers (aka, default m2m behaviour)
perhaps need 2 fact tables? perhaps model data in excel achieve 'split' of facts, see it, whichever way problem cut some calc going need done @ run-time. think?!
ty.
give try, have not checked performance, don't expect them super... nevertheless, @ least looks elegant :)
amount := sumx ( summarize ( mapping, mapping[manager], mapping[rate], mapping[validfrom], mapping[validto], products[products], "salesinperiod", mapping[rate] * calculate ( sum ( sales[amount] ), values ( 'date'[date] ), datesbetween ( 'date'[date], mapping[validfrom], mapping[validto] ) ) ), [salesinperiod] )
if want count, still keeping temporal m2m working, should trick:
count := calculate ( countrows ( sales ), generate ( summarize ( mapping, mapping[validfrom], mapping[validto], products[products] ), datesbetween ( 'date'[date], mapping[validfrom], mapping[validto] ) ), values ( 'date'[date] ) )
this latter version easier, because not need rate , manager (or, needs manager, in filter context , no sumx required since aggregating using canonical m2m)
Comments
Post a Comment