Forum Discussion

test_123_e213's avatar
test_123_e213
Frequent Visitor
7 years ago
Solved

Grouping YTD by weeks not having intended effect

I want to group my data by week, but then the data stops accumulating as shown above. Is there any way to group my YTD data by week? Month would also be great (Sample data is used in the ta...
  • Greg_Deckler's avatar
    Greg_Deckler
    7 years ago

    OK, this may not be what you want but maybe it gets you closer. I took your first table and I created this column:

     

    WeekNum = WEEKNUM([YTDcol2])

    Then I created these two measures:

     

    AccumShift_Dur_Hrs running total in WeekNum = 
    CALCULATE(
    	SUM('Table12'[AccumShift_Dur_Hrs]),
    	FILTER(
    		ALLSELECTED('Table12'[WeekNum]),
    		ISONORAFTER('Table12'[WeekNum], MAX('Table12'[WeekNum]), DESC)
    	)
    )
    
    YTDdelayHrs running total in WeekNum = 
    CALCULATE(
    	SUM('Table12'[YTDdelayHrs]),
    	FILTER(
    		ALLSELECTED('Table12'[WeekNum]),
    		ISONORAFTER('Table12'[WeekNum], MAX('Table12'[WeekNum]), DESC)
    	)
    )

    I could then put my WeekNum column and these two measures in a table visualization and get a running total for each. Is that what you are going for?