Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating Dynamic Master Measures

Hi Guys,

I have a question:

I have uploaded in my app a sales record with some attributes as day, product sold, quantity, price….(all columns).

Day       Product             quantity   price
1 Nov   Red shoes           2             7$
1 Nov   Blue shoes          1             2$

...

2 Nov

3 Nov

....


I have created a master item called months where I add all the days of the month,

And a master item called week, where I add the weeks.

Now, what I want to do is to create three different measures

1) Last 30 days

2) Last 7 days

3) Last 3 days

Basically what I would like to do is to put these three measures in a table as column, in a way that I can see something like

PRODUCT                              Last 30 days          last 7 days          last 3 days


Black shoes sold                              25                         6                         2

Red shoes sold                                95                         12                        7

............


And so on.

The goal would be to create “Auto updating master measures”

This means that every day, when I replace the existing doc with an updated version, my app should be able to scan all the days in the “days” column, find the last 30, last 7 and last 3, and update the master measures.

The product column is then calculated including the master measure in the calculation and it’s automatically updated.

Is this possible?

Thank you in advance

1 Reply
Not applicable
Author

Hi Paolo

you may use a set analysis like

sum({<Day={">=$(=max(Day)-30)"}>} PRODUCT)

this will compute from the last day in the data model

if a day is selected use

sum({<Day={">=$(=max(Day)-30)", Day=}>} PRODUCT)   to not use day selection

best regards

chris

PRODUCT                              Last 30 days          last 7 days          last 3 days


Black shoes sold                              25                         6                         2

Red shoes sold                                95                         12                        7

............