Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Countax / Countx is not funcitoning well

Hi,

 

I have an issue regarding creating correct dax formula. 

 

I have two tables.

  • Team table: unique identifier
  • All data table

I want to get the total right, to show how many people who have at least 75 reviews.

 

Below is the formulas I've tried, but non of them works to get the total right. 

 

Formula 1 tried: 

  • CALCULATE(DISTINCTCOUNT('All data table'[WorkerID]), FILTER('All data table', DISTINCTCOUNT('All data table'[Reviewid]) >= 75))

Formula 2 tried:

  • Var Review 75 =  COUNTAX(VALUES('All data table'[WorkerID]), DISTINCTCOUNT(All data table[Reviewid]) >= 75)
    Var CountTotal = SUMMARIZE('All data table', 'All data table'[WorkerID], "WorkerIDs", Review75)
    Return
    IF(HASONEVALUE('All data table'[WorkerID]), Review75, COUNTAX(CountTotal, [WorkerIDs]))

Formula 3 tried:

  • IF(HASONEVALUE(Team[WorkerID]), CALCULATE(DISTINCTCOUNT('All data table'[WorkerID]), FILTER('All data table', DISTINCTCOUNT('All data table'[Reviewid]) >= 75)), CountX(DISTINCT(Team[WorkerID]), CALCULATE(DISTINCTCOUNT('Team'[WorkerID]), FILTER('All data table', DISTINCTCOUNT('All data table'[Reviewid]) >= 75))))

Formula 4 tried:

  • IF(HASONEVALUE('Team'[WorkerID]), IF(DISTINCTCOUNT('All data table'[Reviewid]) >= 75, 1, BLANK()),
countax(DISTINCT('Team'[WorkerID]), DISTINCTCOUNT('All data table'[Reviewid]) >= 75))
 
Below is the result
 
The total is not matching the calculation result, should be 4 instead of 8.
The purpose I tried all different formulas is to get the total right, which should be 4.
I was using countax and countx, and none of this formula works.
 
Could you help me with the formula please?
 
Thank you!
  • Anonymous's avatar
    Anonymous
    7 years ago

    HI Anonymous ,

     

    Please check on below link:

    Measure Totals, The Final Word

     

    If above not help, you can upload sample file to onedrive or google drive then share link here.
    Notice: do mask on sensitive data.


    Regards,

    Xiaoxin Sheng

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    It seems like a common total level calculate issue on measure formulas, please refer to following blog about measure calculated on total level:

    Measure Totals, The Final Word

     

    If above not help, please share a pbix file with some sample data for further test.


    Regards,
    Xiaoxin Sheng

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      This is what I see when I click the link.

       

       

      Thanks

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI Anonymous ,

         

        Please check on below link:

        Measure Totals, The Final Word

         

        If above not help, you can upload sample file to onedrive or google drive then share link here.
        Notice: do mask on sensitive data.


        Regards,

        Xiaoxin Sheng