Forum Discussion
Anonymous
4 years agoNot applicable
Rolling value calculation
Hi, I have the following question and would like to see if anyone can help. Date Store A Store B Nov-21 20 40 Dec-21 20 40 Jan-22 20 40 Feb-22 20 40 Mar-22 20 40 ...
- Anonymous4 years ago
Hi Anonymous ,
Here are the steps you can follow:
1. Create calculated table.
Table = CALENDAR(MIN('Table1'[Date]),MAX('Table1'[Date]))2. Create measure.
MeasureA = var _mindate=MINX(ALLSELECTED('Table'),[Date]) var _maxdate=MAXX(ALLSELECTED('Table'),[Date]) return DIVIDE( SUMX(FILTER(ALL(Table1), 'Table1'[Date]>=_mindate&&'Table1'[Date]<=_maxdate),[StoreA]), SUMX( FILTER(ALL(Table2), 'Table2'[Date]>=_mindate&&'Table2'[Date]<=_maxdate&&'Table2'[Store]="A"),[Sales]))MeasureB = var _mindate=MINX(ALLSELECTED('Table'),[Date]) var _maxdate=MAXX(ALLSELECTED('Table'),[Date]) return DIVIDE( SUMX(FILTER(ALL(Table1), 'Table1'[Date]>=_mindate&&'Table1'[Date]<=_maxdate),[StoreB]), SUMX( FILTER(ALL(Table2), 'Table2'[Date]>=_mindate&&'Table2'[Date]<=_maxdate&&'Table2'[Store]="B"),[Sales]))3. Result:
If you need pbix, please click here.
Rolling value calculation.pbix
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
amitchandak
Super User
4 years agoAnonymous , Create a common Date table and then you can have measures like
Divide(Sum(Table1[StoreA]), calculate(Sum(Table2[Sales]), filter(Table2, table2[Store] ="A") ) )
Or you can unpivot first table have store there and common store table too
refer
Anonymous
4 years agoNot applicable
Hello,
Is there anyway not using common dates? Since my sales data contains a board range of dates and cannot suit into the store table.
Thank you.