Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Ramees_123
Helper IV
Helper IV

DAX Measure to Calculate the count of records

I have a table with below fields. I need to find out the count of projects which starts in current year which is 2021. I need to consider the rows only with valid year values.

 

Project Name        Start             End

Project 1                Q12020        Q42023

Project 2                Q32021        Q42025

Project 3                Q12022        Q12025

Project 4                Junkdata       Junkdata

 

Please help with dax for creating measure.

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @Ramees_123 ,

 

Try this measure. Because there is a possibility that the project name will be repeated, the DISTINCTCOUNT is repeated.

Distinctcount project =
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Project Name] ),
    FILTER (
        'Table',
        [Start] <> "Junkdata"
            && VALUE ( RIGHT ( 'Table'[Start], 4 ) ) = YEAR ( TODAY () )
    )
)

Screenshot 2021-05-04 100744.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @Ramees_123 ,

 

Try this measure. Because there is a possibility that the project name will be repeated, the DISTINCTCOUNT is repeated.

Distinctcount project =
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Project Name] ),
    FILTER (
        'Table',
        [Start] <> "Junkdata"
            && VALUE ( RIGHT ( 'Table'[Start], 4 ) ) = YEAR ( TODAY () )
    )
)

Screenshot 2021-05-04 100744.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

CNENFRNL
Community Champion
Community Champion

 

= COUNTROWS( FILTER( PROJ, RIGHT( PROJ[Start], 4 ) = "2021" ) )

Screenshot 2021-05-02 105246.png

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.