Power BI Exchange

Please login or click SIGN UP FOR FREE to create your PowerBIUG account to join this user group.
Expand all | Collapse all

COUNT DAX

  • 1.  COUNT DAX

    Bronze Contributor
    Posted 16 days ago
    Hello,

    Below is the measure that I'm using to count the values which are greater than 2.

    Count = 
    CALCULATE(COUNT('Management'[Ageing_Days]),FILTER('Management',[Ageing_Days]>2))+0​

    I have a column named as Process Category. in which I have 3 options, i.e. Process 1, Process 2 and Process 3.

    For Process 1 and Process 2, we use the above measure to count the values from Ageing_Days column, which are greater than 2. This measure works.

    But I would also require the count against Process 3, which will be greater than 10.

    Please suggest.

    ------------------------------
    Prem Guru
    ------------------------------
    Digital Acceleration Binge Day.  January 28th 2021 | 11:00 AM - 2:00 PM EST


  • 2.  RE: COUNT DAX

    Silver Contributor
    Posted 16 days ago
      |   view attached

    Hi Prem,

    Attached demo file.

    This is calculation:

    Count New =
    var _1_2 = FILTER('Management','Management'[Ageing_Days]>2 && 'Management'[Process Category] in {"Process 1","Process 2"})
    var _3 = FILTER('Management','Management'[Ageing_Days]>10 && 'Management'[Process Category] = "Process 3")
    var _summary = UNION(_1_2, _3)
    RETURN
    COUNTROWS(_summary)
    My demo data is this:
    Process Category Ageing_Days
    Process 1 1
    Process 3 1
    Process 2 1
    Process 2 10
    Process 3 12
    Process 1 15
    Process 3 15
    Process 2 2
    Process 2 2
    Process 1 2
    Process 3 3
    Process 1 3
    Process 1 4
    Process 2 6
    Process 3 8
    Alternative is to use new table where you will have 2 columns: Process category, Criteria. Then you join new table to original table using Process category column and use related function to check whether Ageing_Days is higher than criteria. This would make it more dynamic as you would not create static measures.


    ------------------------------
    Nemanja Andic
    BI developer
    Belgrade Serbia
    ------------------------------

    Attachment(s)

    pbix
    Countrows.pbix   15 KB 1 version
    Digital Acceleration Binge Day.  January 28th 2021 | 11:00 AM - 2:00 PM EST


  • 3.  RE: COUNT DAX

    Bronze Contributor
    Posted 15 days ago
    @Nemanja Andic,

    Thank You! the DAX provided ​​by you, seems to fulfill my requirement.

    I'm now playing around with my data, to check if all the values are updated correctly.

    Really appreciated.

    ------------------------------
    Prem Guru
    ------------------------------

    Digital Acceleration Binge Day.  January 28th 2021 | 11:00 AM - 2:00 PM EST