Forum Discussion
Count not working as expected
Hi,
Need help on Count.
Please see below details where you can see what i have and what i am looking for.
This is what i have;
Source Table:
Result I am getting:
Total Where no of Days < 45: This is column where i am calculating IDs where no of days are less than 45. In this case, we have only one row but i am getting 1 in each row.
Expected Result should be: I am trying to count how many IDs are has Less than 45 number of days. In this case, we have only one ID so result should be like this;
Thanks
Hi damit23183
if your Total column is Column, not a measure, try
CALCULATE(DISTINCTCOUNT('Table'[Id]), ALLEXCEPT('Table', 'Table'[Id]), 'Table'[Total] < 45, 'Table'[Total] > 0)Hi damit23183 ,
You can try creating a measure as shown below in the screenshot:
NOTE: Replace 'Region' in the DAX above with your table name.
If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂
Thanks,
Pragati
5 Replies
- az38Community Champion
Hi damit23183
if your Total column is Column, not a measure, try
CALCULATE(DISTINCTCOUNT('Table'[Id]), ALLEXCEPT('Table', 'Table'[Id]), 'Table'[Total] < 45, 'Table'[Total] > 0)- damit23183Microsoft Employee
Thank you for your quick response.
Really Appreciate it.
Your formula also worked perfectly as expected.
Thanks
- Pragati11Super User
Hi damit23183 ,
You can try creating a measure as shown below in the screenshot:
NOTE: Replace 'Region' in the DAX above with your table name.
If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂
Thanks,
Pragati
- damit23183Microsoft Employee
Thank you for your quick response.
Really Appreciate it.
Your formula also worked perfectly as expected.
Thanks
- AnonymousNot applicableHi, I am using below formula to compute for the estimate, however it doesn't return the correct value.
DIVIDE (CALCULATE(COUNTA('Data'[AccPreparation]),'Data'[AccPreparation] = "Within Estimate",CALCULATE(COUNTA('Data'[AccPreparation]), ALL (Data[AccPreparation])))