Forum Discussion

Chris1300's avatar
Chris1300
Helper II
4 years ago

Data changing when adding legend

I have a column chart that shows running total of distinct Login by week date.

 

I then add a legend to the same chart but the distinct count CHANGES (see total values above column). I am unable to understand why this is happening, and also how do I fix it?

 

The "Running Total" is a measure that i wrote, please see screenshot. Please see screenshot. Cant post pbix file due to limitations.

 

Any feedback would be appreciated.

 

 

 

7 Replies

  • your running total calculation is not correct. You need to move the MAX() part outside of the CALCULATE() part (by using a variable). Pseudo code: 

    Running Total = 
    var m = MAX([Date])
    return calculate(distinctcount([NewLogin]),[Date]<=m)

     

    • Chris1300's avatar
      Chris1300
      Helper II

      Did not work. the result is the same even with MAX() outside the calculate or inside.

      • lbendlin's avatar
        lbendlin
        Super User

        Please provide sanitized sample data that fully covers your issue.

  • That's a good one. What the measure does is show the cumulative total for each department.  That is clearly different from the cumulative total across all departments.

    So the measure works correctly, but it doesn't give you the result you expected.  The question is if your expected result actually makes sense?