powerpivot - DAX running total (or count) across 2 groups -


i'm new dax , powerpivots. using powerpivot pull data sql server. data i'm working pretty large , complex i'm considering simplified version of question.

let's have 2 columns, 1 contains product names , 1 contains date product sold. have row each time 1 unit of product sold.

product | date orange  | 08/13/2013 orange  | 08/13/2013 orange  | 08/13/2013 apple   | 08/14/2013 apple   | 08/16/2013 orange  | 08/17/2013 orange  | 08/17/2013 

i want use dax running count of how of product has been sold date on entire data set. end with.

product | date        | cumulative sales orange  | 08/13/2013  | 1 orange  | 08/13/2013  | 2 orange  | 08/13/2013  | 3 apple   | 08/14/2013  | 1 apple   | 08/16/2013  | 2 orange  | 08/17/2013  | 4 orange  | 08/17/2013  | 5 

any appreciated.

edit: 1 more thing, data not ordered date. potentially order date require modification of other things preference not if @ possible. there lot of other formulas in sheet inherited , reordering may break else.

you can make calculated measure in powerpivot handle this. if want cumulative sales time can this:

    calculate(     sum( factsales[salesamount] ),     filter(         all( dimdate) ,         dimdate[datekey] <= max( dimdate[datekey] )     ) ) 

if want able select time period (ex: running total selected weeks or months) can this:

 calculate( sum( factsales[salesamount])  ,                  filter(                     allselected( dimdate),                     dimdate[datekey] <= max( dimdate[datekey] )                 )     ) 

source: javier guillen's blog


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -