Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

SUM function not working

I have a column (advancecareplancompleted)that has binary values- 0,1. I want to sum all the rows to get the total number of 1s. However, power BI returns total as 1. What should I need to do. I tried creating a measure but even that shows same result.

 

 

4 Replies

  • Hi Anonymous ,

     if the goal is to Sum the values, would you consider changing the data type to integer?

     

    I think you might need to use Count instead of sum and filter on value=1

    • ghaines's avatar
      ghaines
      Resolver I

      Based on the name of the column in the visual, it looks like advanceCarePlanCompleted is a column within a project table that is set to 0 or 1.  If you used count for this column, the result would always be blank, 1 or 2.

       

      But I just think we're fumbling in the dark unless the poster adds more details.

  • daXtreme's avatar
    daXtreme
    Solution Sage

    What measure did you create then? You should show us all the things that are relevant to the problem at hand. Hiding details is not the best strategy. What does it mean "binary values"? What type are they? If they're integers, then the measure is simple: SUM( T[Value] ). And that's all you need. If this does not work, then your model is most likely dodgy in some way.

  • We do need more information as other commenters have said.  However, assuming you have set up everything correctly, hover over the visual, click on the filter/funnel icon to check what filters are applied to make sure you are not accidentally filtering the visual to a single project.