I am tracking the number of ads served by day and cumulative for the year. There is a cap on how many ads can be served over the life time and in many instances we serve ads in excess of the capped amount. For billing purposes we can only bill up to the caped amount. I need to create a dax formula that looks at the number of ads served today and determines if all of them are billable, none are billable or if only a portion of them are billable. The last column in the below chart is the result I need. I tried various versions of if statements in DAX to no avail. please HELP! thx!!
[TABLE="width: 433"]
<tbody>[TR]
[TD]Date
[/TD]
[TD]Ads Served
[/TD]
[TD]Running Total
[/TD]
[TD]Max Ads Permitted Lifetime
[/TD]
[TD]Billable Ads for Day
[/TD]
[/TR]
[TR]
[TD]4/29/2013
[/TD]
[TD]9
[/TD]
[TD]9
[/TD]
[TD]662,845
[/TD]
[TD]9
[/TD]
[/TR]
[TR]
[TD]4/30/2013
[/TD]
[TD]5,112
[/TD]
[TD]5,121
[/TD]
[TD]662,845
[/TD]
[TD]5,112
[/TD]
[/TR]
[TR]
[TD]5/1/2013
[/TD]
[TD]156,158
[/TD]
[TD]161,279
[/TD]
[TD]662,845
[/TD]
[TD]156,158
[/TD]
[/TR]
[TR]
[TD]5/2/2013
[/TD]
[TD]503,683
[/TD]
[TD]664,962
[/TD]
[TD]662,845
[/TD]
[TD]501,566
[/TD]
[/TR]
[TR]
[TD]5/3/2013
[/TD]
[TD]209,171
[/TD]
[TD]874,133
[/TD]
[TD]662,845
[/TD]
[TD]0
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 433"]
<tbody>[TR]
[TD]Date
[/TD]
[TD]Ads Served
[/TD]
[TD]Running Total
[/TD]
[TD]Max Ads Permitted Lifetime
[/TD]
[TD]Billable Ads for Day
[/TD]
[/TR]
[TR]
[TD]4/29/2013
[/TD]
[TD]9
[/TD]
[TD]9
[/TD]
[TD]662,845
[/TD]
[TD]9
[/TD]
[/TR]
[TR]
[TD]4/30/2013
[/TD]
[TD]5,112
[/TD]
[TD]5,121
[/TD]
[TD]662,845
[/TD]
[TD]5,112
[/TD]
[/TR]
[TR]
[TD]5/1/2013
[/TD]
[TD]156,158
[/TD]
[TD]161,279
[/TD]
[TD]662,845
[/TD]
[TD]156,158
[/TD]
[/TR]
[TR]
[TD]5/2/2013
[/TD]
[TD]503,683
[/TD]
[TD]664,962
[/TD]
[TD]662,845
[/TD]
[TD]501,566
[/TD]
[/TR]
[TR]
[TD]5/3/2013
[/TD]
[TD]209,171
[/TD]
[TD]874,133
[/TD]
[TD]662,845
[/TD]
[TD]0
[/TD]
[/TR]
</tbody>[/TABLE]