dax.do
1 TopicLimit interval in iterator to next sale - with dax.do example
Hi guys, I have a measure (see below) VAR Iterator = CALCULATETABLE( SUMMARIZE( 'Movements', 'Movements'[ItemId], 'Filter Date'[Day] ), 'Filter Movement Code'[Number] = 2 ) RETURN SUMX( Iterator, VAR MinTag = CALCULATE( MIN( 'Filter Date'[Day] ) ) RETURN CALCULATE( [Sum of Movements], 'Filter Movement Code'[Number] = 235, DATESBETWEEN( 'Filter Date'[Day], MinTag, MinTag + 14 ), ALL( 'Filter Date' ) ) ) This measure iterates over items moved on a given day for a certain reason. For those items I want sum the quantity (sum of movements) with another reason 14 days after the initial movement. However, if the same item has been moved again with reason 2 within 14 days, I want to decrease the relevant date-interval from the initial movement (no = 2) until the next movement (no = 2). So basically it's either 14 days if there's no subsequent movement or the number of days between first movement and next movement (of no = 2). I have tried to adapt the problem: https://dax.do/tMtgqnPYWGBrjT/ What products where sold in Rockhampton and have been sold within the next two weeks in Seaford. However, if the same product was sold twice within 14 days in Rockhampton the interval shouldn't be 14 days but the number of days between the two sales. Thank you for your help! KonstantinSolved792Views0likes4Comments