Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Year to Date Rolling Total by Location

Good Day,

 

I am needing to a do a rolling total by year and location. If I filter it down to one location I get the correct results but having all locations selected in the column chart it gives wonky numbers. Can someone help me?
I currently have this formula

***
Better RT =
    VAR __Date = MAX('Assets'[Created_Date])
    VAR __Table = FILTER(ALLSELECTED('Assets'),[Created_Date] <= __Date)
RETURN
    SUMX(__Table,[Status Bit])
***

to get the rolling total and 

IF I have all locations filtered 



Filtering one location = correct results


Start adding more locations and it will start getting all wonky. 



 

 

 

 

 

  • Anonymous Try:

    Better RT =
        VAR __Date = MAX('Assets'[Created_Date])
        VAR __Location = MAX('Assets'[MC's (2) Branch_Location])
        VAR __Table = FILTER(ALLSELECTED('Assets'),[Created_Date] <= __Date && [MC's (2) Branch_Location] = __Location)
    RETURN
        SUMX(__Table,[Status Bit])

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Anonymous Try:

    Better RT =
        VAR __Date = MAX('Assets'[Created_Date])
        VAR __Location = MAX('Assets'[MC's (2) Branch_Location])
        VAR __Table = FILTER(ALLSELECTED('Assets'),[Created_Date] <= __Date && [MC's (2) Branch_Location] = __Location)
    RETURN
        SUMX(__Table,[Status Bit])