Forum Discussion

king5six1's avatar
king5six1
Regular Visitor
7 years ago
Solved

Help with COUNTIFS Formula in DAX

Hello. Newbie here. I have a problem I have been trying to solve to no avail. I have a COUNTIF formual in excel that is returning a percentage based on several columns. I cannot get this working in DAX. I tried several different ways based on search results. Hoping someone can help me out. 

 

The formula I have currently is

 

=IFERROR(COUNTIFS('CSAT Data'!$N:$N,1,'CSAT Data'!$K:$K,$U9&"*",'CSAT Data'!$R:$R,$A9)/COUNTIFS('CSAT Data'!$Q:$Q,1,'RPI CSAT Data'!$K:$K,$U9&"*",'CSAT Data'!$R:$R,$A9),"-")

 

I have a column "N" Labeled Negative Count where 1=yes and 0=No

Column K is Team Names

Column R is week ending date

Column Q is count where everything = 1

 

The formula is taking a Count of Negative Items that equal 1 by support tier and dividing it by the total number of Count.

 

EX: Team = 'Platinum' has a count of 25 and 2 of those are Negatives. So 2/25 = 8%

 

Any help is greatly appreciated.

 

 

4 Replies

  • BobBI's avatar
    BobBI
    Resolver III

     

    Hi ,

     

    Can you post your power bi table with value so i could write the DAX with reference to those cols.

    Just to give you a quick headaround

     

    Thanks,

    Bob

    • king5six1's avatar
      king5six1
      Regular Visitor

      Im not sure I can post the whole thing. There is some confidential info in there. If this helps, the specific column names are. I am trying to rebuild an excel report from scratch using the source salesforce reports in Power BI.

       

      Negative Score

      Count

      Representative: Role: Name (groups) - This is the teams. I had to create a group for them as several roles make up a Team.

      • v-danhe-msft's avatar
        v-danhe-msft
        Microsoft Employee

        Hi king5six1,

        Based on my test, you could use the Count function to calculate the percentage:

        Sample data:

        Create a measure:

        Measure = CALCULATE(COUNT(Table1[N]),FILTER('Table1','Table1'[N]=1))/CALCULATE(COUNT(Table1[Q]),FILTER('Table1','Table1'[Q]=1))

        Result:

        You could also download the pbix file to have a view.

         

        Regards,

        Daniel He

  • v-danhe-msft's avatar
    v-danhe-msft
    Microsoft Employee

    Hi king5six1,

    Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

     

    Regards,

    Daniel He