Forum Discussion

davidsimm10's avatar
davidsimm10
Frequent Visitor
5 years ago

Sum error

DaysAbove = what-if parameter

 

I have a tabular table with Date and CountID and a DaysWhereFlag. (If the count of that ID goes over the 'DaysAbove')

 

DaysWhereFlag =
IF(COUNT(BedModelData[PatientMeditechID]) > 'tbl_DaysAbove'[DaysAboveValue], 1, 0)
 
The DaysWhereFlag has 1s or 0s in. The total is always 1 but would like to SUM the 1's.
 
I have tried so many different ways, looked at many websites but just cannot get it to work. Any help will be greatly appreciated.
 

8 Replies

  • vanessafvg's avatar
    vanessafvg
    Community Champion

    are you able to provide some sampel data or your pbix?

     

    please also demonstrate an example of what you want to see.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi 

    Have you tried:

    Calculate(Sum(DaysWhereFlags),Filter(TableName, (BedModelData[PatientMeditechID]) > ('tbl_DaysAbove'[DaysAboveValue]))

    • davidsimm10's avatar
      davidsimm10
      Frequent Visitor

      Thank you for the replies. The 'DaysWhereFlag' is a measure so it wont allow it to be put into the dax above.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi,

        What i found here is you giving flag value in measure instead of generating the measure, Generate the same value in the Calculated column and then try same formula.

        I hope this will help you.

        Thanks.
        Gaurav Jangra

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi davidsimm10 


    now use the formula; 
    Calculate(Sum(DaysWhereFlags),Filter(TableName, (BedModelData[PatientMeditechID]) > ('tbl_DaysAbove'[DaysAboveValue]))

    • davidsimm10's avatar
      davidsimm10
      Frequent Visitor

      Thats the same answer you said last time so no, it still doesnt work im afraid

  • Anonymous's avatar
    Anonymous
    Not applicable

    davidsimm10 

    You can just sum the flag measure, try:

     

    measure = Sumx(All(table), DaysWhereFlags)  

    or 

    measure = Sumx(table,DaysWhereFlags)

     


    Paul Zheng _ Community Support Team
    If this post helps, please Accept it as the solution to help the other members find it more quickly.