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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
WJ876400
Helper IV
Helper IV

Counting dates and difference

Hi

 

I have the below data set

 

IDDate 1Date 2
101/01/2023 
102/01/202302/01/2023
103/01/202303/01/2023
204/01/2023 
205/01/202305/01/2023

 

I have put the data in a mtrix table so that I can see the ID number and the total number of date 1 for each ID and then total number of Date 2. I have put them in a matrix as a count of dates. I want to add a column in to look at the total differences like below. What formula do I use to count the total number of date 1 and then subtract against the total of Date 2 so I can get the difference. hope that makes sense, thank you

 

IDDate 1 totalDate 2 totalDifference
1321
2211
3 REPLIES 3
Anonymous
Not applicable
Greg_Deckler
Community Champion
Community Champion

@WJ876400 Maybe:

totalDifference Measure =
  VAR __Date1 = COUNTROWS(FILTER('Table',[Date 1] <> BLANK())
  VAR __Date2 = COUNTROWS(FILTER('Table',[Date 2] <> BLANK())
  VAR __Result = __Date1 - __Date2
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you for the quick response, I got an error on my measure can you see where I went wrong?

 

WJ876400_0-1676558959210.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.