Forum Discussion
Historical Running Total
Hi everyone:
I am having a problem getting this measure to work. I currently have a historical table of all transactions from the beginning of time. I need to be able to have a measure dictact the first date the product is available then sum everything that occurred before that date.
I have tried the following measures with no avail.
CALCULATE(
SUM(INVEN_MmtLineDetail[Qty]),
FILTER(DATE_Calendar_pbi,
DATE_Calendar_pbi[Date] <= FIRSTNONBLANK(PROD__Master_Style[Date Avail],1)
)
)CALCULATE(
SUM(INVEN_MmtLineDetail[Qty]),
FILTER(DATE_Calendar_pbi,
AND(
DATE_Calendar_pbi[Date] <= MAX(DATE_Calendar_pbi[Date]),
MAX(DATE_Calendar_pbi[Date]) = FIRSTNONBLANK(PROD__Master_Style[Date Avail])
)
)
)The first measure returns a much larger number, while the 2nd returns nothing at all.
Most of the time when I am calculating a running total measure it goes like this with no problem:
CALCULATE( SUM(SALES_OrderSize[NetOrdUnits]), FILTER( ALL(DATE_OrderEntry[Date]), DATE_OrderEntry[Date] <= MAX(DATE_OrderEntry[Date]) ) )
The only difference in the first measure is that I am referencing the 2nd date from a separate table rather than the same table.
Let me know if you have any additional questions.
Thanks.
2 Replies
- Ashish_MathurSuper User
Hi,
Share a dataset and show the expected result.
- mmcgwireFrequent Visitor
Hi Ashish:
I actually can't do that since a lot of the information in this dataset is sensitive cost and pricing. If there is anything else I can share with you to help with this DAX issue, let me know.
Thanks.