locked
Calculate with a measure RRS feed

  • Question

  • Hello. For the code below, can I replace the "counta" portion with a "count" measure? 

    Cumulative Count:=If(
       Min('Date'[Date])
             <= CALCULATE(MAX(Contracts[CO Buyer Effective DT] ), All(Contracts)),
            Calculate(
                    Counta(Contracts[CO ID]),
                     Filter(
                           ALL('Date'[Date]), 
                          'Date'[Date] <= MAX('Date'[Date])
            )
          )

    Thursday, September 1, 2016 12:06 AM

Answers

  • Hi Albo44,

    >> If you have created a calculated measure, can you use that in place of the COUNT or COUNTA function?

    Yes, the COUNT and COUNTA function both can be used in the place of measure. The functions are applied in different scenarios. As I post, which function you use in the measure depends on the data type of the column[CO ID] and your requirements. 

    If you have any questions , please don’t hesitate to let me know.
    • Marked as answer by Albo44 Tuesday, September 6, 2016 5:56 PM
    Tuesday, September 6, 2016 2:31 AM

All replies

  • Hi Albo44,

    The COUNT function counts the number of cells in a column that contain numbers. And COUNTA function counts the number of cells in a column that are not empty. It counts not just rows that contain numeric values, but also rows that contain nonblank values, including text, dates, and logical values.

    For your issue, if the column “CO ID” are all numbers without empty, or you want to count only the cells that contain numbers, , you can use the COUNT functions. Otherwise, you can’t I replace the "counta" portion with a "count".

    Reference
    https://msdn.microsoft.com/en-us/library/ee634791.aspx
    https://msdn.microsoft.com/en-us/library/ee634956.aspx

    If you have any questions , please don’t hesitate to let me know.

    Regards,


    Charlie Liao
    TechNet Community Support

    Thursday, September 1, 2016 5:53 AM
  • Hi Charlie, sorry I guess I wasn't clear. I meant, if you have created a calculated measure, can you use that in place of the count or countA function? Essentially it would just be a calculated measure. Thanks. 
    Thursday, September 1, 2016 6:32 PM
  • Hi Albo44,

    >> If you have created a calculated measure, can you use that in place of the COUNT or COUNTA function?

    Yes, the COUNT and COUNTA function both can be used in the place of measure. The functions are applied in different scenarios. As I post, which function you use in the measure depends on the data type of the column[CO ID] and your requirements. 

    If you have any questions , please don’t hesitate to let me know.
    • Marked as answer by Albo44 Tuesday, September 6, 2016 5:56 PM
    Tuesday, September 6, 2016 2:31 AM