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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
julrua
Frequent Visitor

MEASURE DISTINCTCOUNT - LASTDATE/ MAXSCORE

Dear all, 

 

Objective: I want to develop a measure to count distincly the number of my project based on the last date. I have the following column refering to a date: 

  • Month Running: Jan, Feb, etc. Format: Text 
  • YTD: YTD01, YTD02, etc. Format: Text 

I have transformed Month Running into date and extract Month.

This steps was to use the following measure: =

CALCULATE(DISTINCTCOUNT('Business management (customer HUB)'[Project Definition 2]),LASTDATE('Evolution analyses'[Month Running ]))
 
I have tried several options but I still get an error message that my column is not in date format. 
Would it be possible to score Month Running from 1 to 12 and count based on the max number? 
 
Thank you in advance for you help. 
Kind regards, 

 

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

@julrua 

To calculate the max month you must have a month number column instead month name column, because you cannot compare Texts. With month number column, you can try the following formula:

 

For example:
column = CALCULATE(DISTINCTCOUNT('Business management (customer HUB)'[Project Definition 2]),filter('Business management (customer HUB)', [month number] = maxx(all(['Business management (customer HUB)'),[month number])))

Instead of share the image, if you can just provide a sample table with a date column that allow me to copy paste. I could make a test and come out with a more definite solution.

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
V-pazhen-msft
Community Support
Community Support

@julrua 

To calculate the max month you must have a month number column instead month name column, because you cannot compare Texts. With month number column, you can try the following formula:

 

For example:
column = CALCULATE(DISTINCTCOUNT('Business management (customer HUB)'[Project Definition 2]),filter('Business management (customer HUB)', [month number] = maxx(all(['Business management (customer HUB)'),[month number])))

Instead of share the image, if you can just provide a sample table with a date column that allow me to copy paste. I could make a test and come out with a more definite solution.

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@julrua , not very clear. Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

check if these can help closingbalancemonth, closingbalanceyear : https://youtu.be/yPQ9UV37LOU

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak thank you for you quick reply. 

 

I have the following information into Evolution analyses table. 

I need to count distincly the number of project definition for the last period.

For example, I will need to calculate the distinct number of project definition for December because it is the last period for 2020. 

julrua_0-1619437433739.png

Is that more clear? 

Thank you

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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