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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

count of how many dates match

Hello, 

 

I have a table that I am essentially trying to flatten out, It looks like this

 

Planned Date

Actual Date

1/1/211/3/21
1/4/211/3/21
1/5/211/5/21

 

I have created a 2nd table as my calander and I would like to have the count of the above dates;

 

Calander DatePlanned CountActual Count
1/1/2110
1/2/2100
1/3/2102
1/4/2110
1/5/2111

 

 

Any tips on how to make the planned count and actual count columns?

 

Thanks!

 

 

5 REPLIES 5
VahidDM
Super User
Super User

hi @Anonymous 

Try these measures:

Count Of Date Actual =
VAR _Date =
    MAX ( 'Calendar Table'[Calander Date] )
RETURN
    VAR _ActualDate =
        CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Actual Date] = _Date )
    RETURN
        IF ( ISBLANK ( _ActualDate ), 0, _ActualDate )
Count Of Date Planned =
VAR _Date =
    MAX ( 'Calendar Table'[Calander Date] )
RETURN
    VAR _PlannedDate =
        CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Planned Date] = _Date )
    RETURN
        IF ( ISBLANK ( _PlannedDate ), 0, _PlannedDate )

 

The output sill be as follow:

VahidDM_0-1629344178592.png

VahidDM_2-1629344229235.png

 

 

Did I answer your question? Mark my post as a solution!

Appreciate your Kudos VahidDM_1-1629344200315.png !!

 

 

Fowmy
Super User
Super User

@Anonymous 

You can build a calculated column as follows and follow the same for the actual as well:

 

Planned Date Count = 
VAR __DATE = TABLE2[DATE] RETURN
COUNTROWS(
    FILTER( VALUES(table1[planned date]), table1[planned date] = __DATE )  
)

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

@Fowmy Thanks! This is working well but what if I have 2 items with the same date? It is just returning a '1' in these cases. How can I modify to count all the matching dates?

Hi @Fowmy ,

How did you manage to put column in variable?

VAR __DATE = TABLE2[DATE]

In my case never works.

Thanks.
 



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

@Migasuke 

Yes, I mentioned it as a measure, it should be a calculated column. I changed the word in my reply.

Thanks 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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