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

Max Date Count

Hello,

 

I am pretty new to power bi and would like to calculate the sum of the max date in the below table

Product IdDate
17/21/2021 18:49
27/20/2021 18:49
37/19/2021 18:49
47/20/2021 18:49
57/21/2021 18:49
67/22/2021 18:49
77/22/2021 18:49
87/22/2021 18:49
97/22/2021 18:49
107/22/2021 18:49

 

In this case it is going to be 5. Could you please help me with the DAX.

Thanks
AD

4 REPLIES 4
Samarth_18
Community Champion
Community Champion

Hi @Anonymous ,

 

You can try below code:-

count_of_dates = 
CALCULATE ( COUNT ( 'Product_data'[Date] ), LASTDATE('Product_data'[Date]) )

output:-

Samarth_18_0-1627017729901.png

Thanks

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

Thank you so much. That worked. One last question. if I use the similar table with few more information :

ProductDateNameADDRESS
17/21/2021 18:49Aabc
27/20/2021 18:49Bdef
37/19/2021 18:49Cdhk
47/20/2021 18:49Dscj
57/21/2021 18:49Esbn
67/22/2021 18:49Fsjx
77/22/2021 18:49Gscn
87/22/2021 18:49Hivd
97/22/2021 18:49Iskl
107/22/2021 18:49Jkjs

 

Now I want to create a table with product, name and address using the max date, how do I do that?

Hi @Anonymous 

 

You can directly drag your fields on table visual and take a latest of your date. PFB screenshot for reference:-

 

Samarth_18_0-1627058910950.png

Note:- You can get latest option when you right click on Date in Values Pane

Samarth_18_1-1627058978743.png

 

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

VahidDM
Super User
Super User

Hi @Anonymous ,

 

First, you need to find the Max, so you can write the below code to find the Max :

VAR _MaxDate = MAX ( 'Product'[Date] )
then use this VAR to calculate the sum of the max date (Count):
CALCULATE ( COUNTA ( 'Product'[Date] ), 'Product'[Date] = _MaxDate )
 
 
So the Measure is as below:
(make sure the table and column names are aligned with your file, then Copy and paste that on your file)
 
Sum of the Max =
VAR _MaxDate =
MAX ( 'Product'[Date] )
RETURN
CALCULATE ( COUNTA ( 'Product'[Date] ), 'Product'[Date] = _MaxDate )

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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