Forum Discussion

ryanxngo's avatar
ryanxngo
New Member
2 years ago
Solved

FILTER using column values instead of a scalar value

I am trying to create a cumulative sum measure using the following formula: Cumulative_Cash = VAR CurrentRowDate = MAX(FactSales[CalendarDate]) VAR SelectedGrains = VALUES(FactSales[Grain]) ...
  • FreemanZ's avatar
    FreemanZ
    2 years ago

    hi ryanxngo ,

     

    try like:

    1) add a calculated column like:

     

    MonthNO = FORMAT([Date], "YYYYMM")

     

     2) plot a table visual with month column and a measure like:

     

    C_Cash = 
    SUMX(
        FILTER(
            ALLSELECTED(data), 
            data[MonthNO]<=MAX(data[MonthNO])
        ),
        data[Cash]
    )

     

    or 

     

    C_Cash2 = 
    CALCULATE(
        SUM(data[Cash]),
        ALLSELECTED(data), 
        data[MonthNO]<=MAX(data[MonthNO])
    )

     

     

    it worked like: