Forum Discussion

josuesanchezSA's avatar
josuesanchezSA
Frequent Visitor
2 years ago
Solved

Missing values in cumulative dax

Hello,    I am trying to get a cumulative total which as you can see below it works, except in period 05 and 09, the totals should be 68 for period 05 and 108 for period 09. Since there were no val...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi josuesanchezSA ,

    Based on the description, try the following methods:

    Measure 2 = 
    VAR startyear = DATE(2023, 01, 01)
    VAR enddate = MAX('Table1'[Date]) - 365
    VAR CurrentDate = MAX('Table'[Date])
    var _period = SELECTEDVALUE(Table1[Month Period])
    var result = CALCULATE(
        COUNTA('Table1'[ID]),
        FILTER(
            ALL('Table'),
            'Table'[Date] <= CurrentDate
                && 'Table'[Date] >= startyear
                && 'Table'[Date] < enddate
        )
    
    )
    RETURN
    IF(ISBLANK(result) || _period > 9, 0 , result)

     

    Best Regards,

    Wisdom Wu

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