Forum Discussion

fazou's avatar
fazou
Frequent Visitor
1 year ago
Solved

Runing total display

Hello Guys, as you seen here when i select a filter PRODUCT_SEASON it display runing total cumulative in good way. but when i add a WEEKOFSEASON filter for exp 24W38 it display only one...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi fazou 

     

    Thank you very much freginier and DataNinja777 for your prompt reply.

     

    For your question, here is the method I provided:

     

    Here's some dummy data

     

    “TBF_SALES”

     

    “TBD_DATE_REFERENCE”

     

     

    Create a measure.

     

    RUNNING NET SALES SEASON = 
    VAR CurrentWeek = MAX(TBD_DATE_REFERENCE[WEEKOFSEASON])
    VAR CurrentSeason = SELECTEDVALUE(TBF_SALES[PRODUCT_SEASON])
    
    VAR FirstSeasonWeek =
        MINX(
            FILTER(
                ALL(TBF_SALES),
                TBF_SALES[PRODUCT_SEASON] = CurrentSeason
            ),
            RELATED(TBD_DATE_REFERENCE[WEEKOFSEASON])
        )
    
    RETURN
    CALCULATE(
        SUM(TBF_SALES[NET_SALES]),
        FILTER(
            ALL(TBD_DATE_REFERENCE),
            TBD_DATE_REFERENCE[WEEKOFSEASON] >= FirstSeasonWeek && TBD_DATE_REFERENCE[WEEKOFSEASON] <= CurrentWeek
        ),
        TBF_SALES[PRODUCT_SEASON] = CurrentSeason,
        REMOVEFILTERS(TBD_DATE_REFERENCE[WEEKOFSEASON])
    )

     

    Here is the result.

     

     

    Regards,

    Nono Chen

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.