I'm building a report to control the stock of some materials. I have a great list with a large amount of movement data (3,3 million rows)... every movement has its own center (where movement happened), material code, date (when movement happened), type of movement (entrance, consumption, transference...), qty, value, etc. I need to check, for each material and center, when was the last consumption movement happened, compare to the max date from a calendar table, calculate how many days between, and classify in groups (0-30 days, 31-90 days, 91-180 days, etc...).
Is there a way to do this using only measures? I accomplish using tables, but I have a static result. I need to do this in a dynamic way (filtering my Calendar table will adjust the result)...
My fact table has the structure according to the picture below.
For each [Cen.], [Material], filtered by [TMv] = 201 or 261, return the formula Today() - Max([Dt.lçto])
I would appreciate it if someone could help.
Thanks a lot!!!