Forum Discussion
afbraga66
Helper III
4 years agoCOUNT/COUNTROWS return 0 instead of blank
Hello,
I am currently have an issue with count/countrows. When they evaluate and return nothing it shows blank instead of 0.
I have 2 tables, a calendar table and a fact table with 10 rows.
I am trying to calculate the percentage of colum ORIT = "Y".
Lines ORIT2 =
var _orit = CALCULATE(COUNTROWS(dataVN),dataVN[ORIT]="Y")
return if(ISBLANK(_orit),0,_orit)
The result is this. I don't want those extra lines that mean nothing.
The manufacturing data field comes from the calendar table.
How can I avoid this situation and get the desired result?
The .pbix file is in this link if you want to try - https://we.tl/t-bHGwtdUf5d
Thank you.
André
Hi afbraga66
Please try https://www.dropbox.com/t/Fm7RwOsIaqz2DuogLines ORIT2 = IF ( NOT ISEMPTY ( dataVN ), COALESCE ( CALCULATE ( COUNTROWS ( dataVN ), dataVN[ORIT] = "Y" ), 0 ) )
6 Replies
- vapid128
Solution Specialist
CALCULATE(COUNTROWS(dataVN),dataVN[ORIT]="Y") + 0 - tamerj1
Community Champion
Hi afbraga66
Please try https://www.dropbox.com/t/Fm7RwOsIaqz2DuogLines ORIT2 = IF ( NOT ISEMPTY ( dataVN ), COALESCE ( CALCULATE ( COUNTROWS ( dataVN ), dataVN[ORIT] = "Y" ), 0 ) )