Forum Discussion

Ben_Schenck's avatar
Ben_Schenck
Regular Visitor
2 years ago
Solved

cumulative total + missing data

Hi,

I'm having some troubles with the following.
I'm calculating a cumulative total going back in time, which is my timeline 0 = today, 1 yesterday and so on.

 

Cumulative SQL1% =
CALCULATE(
    [SQL1%],
    FILTER(
        ALLSELECTED('Calendar3'),
        'Calendar3'[Timeline] <= MAX('Calendar3'[Timeline] )
    )

SQL1% =
DIVIDE([Activated],[SQL])
 
Activated = CALCULATE(
    SUM(ClientDays[Activated]),
        ClientDays[StopReason__c] <> ""
    )
)

SQL = CALCULATE(
    COUNT(ClientDays[Id]),
        ClientDays[StopReason__c] <> ""
    )

Now I have the issue when I don't have data for this multiple on that day the Y-axis drops to 0, I would like it to be like the purple line. It ignoring the fact there's no data for that day. 

 

Thank you in advance for your input.


  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Ben_Schenck ,

    Based on my testing, please try the following methods:

    1.Create the simple table.

     

    2.Create the new measure to calculate.

    Cumulative SQL1% = 
    VAR activ_ = SELECTEDVALUE('Table 1'[Activated])
    VAR sq_ = SELECTEDVALUE('Table 1'[SQL])
    VAR sql_1 = DIVIDE(activ_, sq_)
    VAR calcu_ = CALCULATE(
        DIVIDE(activ_, sq_),
        FILTER(
            ALLSELECTED('Table 1'),
            'Table 1'[Timeline] <= MAX('Table 1'[Timeline])
        ))
    RETURN
    IF(
        calcu_ = 0,
        BLANK(),
        calcu_
    )

     

     

    3.Drag the measure into the Line chart.

    4.The result is shown below.

     

    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.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Ben_Schenck ,

    Based on my testing, please try the following methods:

    1.Create the simple table.

     

    2.Create the new measure to calculate.

    Cumulative SQL1% = 
    VAR activ_ = SELECTEDVALUE('Table 1'[Activated])
    VAR sq_ = SELECTEDVALUE('Table 1'[SQL])
    VAR sql_1 = DIVIDE(activ_, sq_)
    VAR calcu_ = CALCULATE(
        DIVIDE(activ_, sq_),
        FILTER(
            ALLSELECTED('Table 1'),
            'Table 1'[Timeline] <= MAX('Table 1'[Timeline])
        ))
    RETURN
    IF(
        calcu_ = 0,
        BLANK(),
        calcu_
    )

     

     

    3.Drag the measure into the Line chart.

    4.The result is shown below.

     

    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.