cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Anonymous
Not applicable

## Count rows where year is .....

Hi,

Ive got an excel import of orders.

One of the collums is called [reden van annulering] I want to count all the rows where the Year value is, for example, 2021.

Tried formula below but this won't work. Any one an idea what i should use instead?

annuleringen 2021 = CALCULATE( COUNTROWS(ALL(Sheet0[reden voor annulering] where YEAR ( Sheet0[datum verwijsbrief] ) = 2021)))

2 ACCEPTED SOLUTIONS
Solution Sage

Hi @Anonymous .

Try this DAX;

annuleringen 2021 = CALCULATE( COUNTROWS(Sheet0), YEAR ( Sheet0[datum verwijsbrief] ) = 2021)).

Regards,
Sanket.

If this post helps , then mark it as 'Accept as Answer' and give it a thumbs up.

Community Support

Hi @Anonymous

It seems you want to count the non-blank rows in [reden voor annulering] column for every year. You can first add a Year column to the table.

Then create the following measure

``Count Measure = CALCULATE(COUNT(Sheet0[reden voor annulering]),Sheet0[reden voor annulering]<>BLANK())``

Put Year column and the measure into a table visual, you will get the count for every year.

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

4 REPLIES 4
Community Support

Hi @Anonymous

It seems you want to count the non-blank rows in [reden voor annulering] column for every year. You can first add a Year column to the table.

Then create the following measure

``Count Measure = CALCULATE(COUNT(Sheet0[reden voor annulering]),Sheet0[reden voor annulering]<>BLANK())``

Put Year column and the measure into a table visual, you will get the count for every year.

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Anonymous
Not applicable

Anonymous
Not applicable

This way it counts all the rows, i want only to count the rows in column Sheet0[reden voor annulering] idf this is filled with an tekst value (this tekst are different reasons)

Solution Sage

Hi @Anonymous .

Try this DAX;

annuleringen 2021 = CALCULATE( COUNTROWS(Sheet0), YEAR ( Sheet0[datum verwijsbrief] ) = 2021)).

Regards,
Sanket.

If this post helps , then mark it as 'Accept as Answer' and give it a thumbs up.

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors