0
votes

I have an SSAS tabular model based on Inventory data. The data contains not only the current (i.e. todays) On Hand values, but also 90 days worth of history. Here is a very small sample of data:

enter image description here

I need to create a DAX measure that will return that MAX Qty on Hand for each Material over the 90 days worth of history. In the sample above, the MAX would be 6, because on 2-Dec there was 3 in Loc A and 3 in Loc b.

I have tried the following DAX calculation:

CALCULATE (MAX(Inventory[SAP Qty On Hand]), ALL('Date'))

However, this is returning 3, rather than 6. It needs to aggregate by date before doing the MAX.

Any ideas?

1

1 Answers

0
votes

Try creating a summary table first, then taking the max of the summary

MAXX(
    SUMMARIZE(
        'Inventory',
        [Date],
        "Total Date Qty",
        SUM([SAP Qty On Hand])
    ),
    [Total Date Qty]
)