Forum Discussion

MonyridhYady's avatar
MonyridhYady
Frequent Visitor
3 years ago
Solved

Countifs + Filter in Dax

Hi all I'm fairly new to PBI and is looking for a way I could replicate a countifs function on dax. I have examples in the screenshots below of what I want to replicate on excel

 

Context for Excel screenshot below, I have 10 companies but 2 of them are duplicates (Company C and D) because they subscribed to a different Plan. Hence, I am counting 12 which is what I want. The bar chart is also something I want in PBI as well.

 

Context for the excel screenshot below: This is the data that I currently have. There are over thousands of row for each month where companies renew their plans (We can existing) and other companies start their plans with us (New)

 

So to reiterate my question: I would like to only filter out existing companies plans with us and only countifs new companies subscriptions. So that if a company has one subscription with us we will count that as 1 new connection, if a company has 3 plans with us we will count that as 3 new connections

 

Cheers, I hope I've made my question clear since it was quite confusing for me to write this

 

 

  • MonyridhYady's avatar
    MonyridhYady
    3 years ago

    Thanks for the help, but I think I solved it using this after watching a few videos.

     

    CountNew =
    SUMX(SUMMARIZE(Data,'Date'[Month Year],Data[company_name],Data[Plan_edit],"Total_count",1),[Total_count])

2 Replies

  • Hi , MonyridhYady 

    (1)For your first need , you just need to put the filed on the visual , like this :

    And my test data is as follows:

     

    (2)For you second need ,This is my test data:

    We need to click "New measure "to create a measure :

    Measure = var _t = FILTER('Table2','Table2'[stausplan_name] ="EXISTING")
    return
    COUNTROWS(_t)

    Then we put the filed in the visual and we will meet your need :

     

    If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

     

    Best Regards,

    Aniya Zhang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

    • MonyridhYady's avatar
      MonyridhYady
      Frequent Visitor

      Thanks for the help, but I think I solved it using this after watching a few videos.

       

      CountNew =
      SUMX(SUMMARIZE(Data,'Date'[Month Year],Data[company_name],Data[Plan_edit],"Total_count",1),[Total_count])