Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi Experts,
I would like to count a specific year date in a column. I'm using IF condition or statement to do that.
Let says I want to see data for 2020, 2019 and the blank data. In this case i create a column with conditions IF like below.
COUNTS2020 = IF(YEAR('Data2020'[Batch Return])=2020,0,1) - (Expected result to get count of data for 2020 is = 2488)
COUNTS2019 = IF(YEAR('Data2020'[Batch Return])=2019,0,1) - (Expected result to get count of data for 2019 is = 4)
and for the Blank is expected to get count = 7823
But somehow, the results doesn't get as per what i expected.
What went wrong?
Btw, pbix file at this link https://1drv.ms/u/s!AqKwe2kf8OBIdI-2vH30jrTDBxA?e=bpF3qC
Thanks
Solved! Go to Solution.
@Zaky , Try measures like
2020 = calculate(countrows('Data2020'), filter('Data2020', YEAR('Data2020'[Batch Return])=2020))
2019= calculate(countrows('Data2020'), filter('Data2020', YEAR('Data2020'[Batch Return])=2019))
@Zaky , Try measures like
2020 = calculate(countrows('Data2020'), filter('Data2020', YEAR('Data2020'[Batch Return])=2020))
2019= calculate(countrows('Data2020'), filter('Data2020', YEAR('Data2020'[Batch Return])=2019))