cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper IV
Helper IV

Count Specific Year Date in a column

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

 

specific date.JPG

 

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

 

1 ACCEPTED SOLUTION
Super User IV
Super User IV

@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))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

2 REPLIES 2
Super User IV
Super User IV

@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))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Dear @amitchandak ,

Got it!.

Thank you so much bro 😅

Helpful resources

Announcements
secondImage

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

secondImage

Power BI Women

Join our monthly meetings and learning sessions.

secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors