Forum Discussion
YTD with no context
I bet this has been asked before and I should know the answer as well, but it just escapes me and I can't find it. So I tried to reproduce with the table below.
Column1 : Time Variable
Column2 : Product variable
Column3 : Quantity variable
| 1 | A | 3 |
| 2 | A | 8 |
| 3 | A | 7 |
| 4 | A | 12 |
| 5 | A | 5 |
| 6 | A | 1 |
| 7 | A | 18 |
| 1 | B | 3 |
| 3 | B | 5 |
| 4 | B | 4 |
| 5 | B | 6 |
| 7 | B | 9 |
Then I created the following measure:
Sum =
11 Replies
- Greg_Deckler
Community Champion
DouweMeer - Seems to me that you should create a disconnected table like this:
Table = DISTINCT('CurrentTable'[Time Value])
Or just use GENERATESERIES
Use that as your columns. Then you can grab the value of the current column using MAX/MAXX or SELECTEDVALUE and get everything <= that value from your other table. Should fix you right up.
- DouweMeer
Impactful Individual
Would it really need a disconnected table? Otherwise I see the consequence that you would be better off just create the whole table as a disconnected table and use its columns as filters :).
- Greg_Deckler
Community Champion
DouweMeer I'm guessing because apparently:
Sum =
VAR a1 = max ( 'Test table'[Time Variable] )RETURNcalculate (sumx ( filter ( 'Test table' , 'Test table'[Time Variable] <= a1 ) , [Quantity variable] ), all ( 'Test table'[Time Variable] ))Is not returning what you want. And the reason is that since there is no 2 I'm guessing that your a1 is getting set to blank for the intersection of B and 2 and thus, you need a disconnected table so that you always have a value for Time Variable and thus a1.That's my opinion.