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
Anonymous
Not applicable

Calculating % of Month Complete

Trying to project some figures based on where we are in the current month. For example, we sold 10 units through the first 25% of the month, we're on pace for 40 units.

 

I was able to do this originally by adding a table that captured when Power BI was last refreshed. However, each account I'm trying to calculate the pacing for gets updated within the database at various times, this is captured in a field labeled 'Last Change'.

 

I'm looking for a way to calculate the % of the month that has been completed for each account, based on their last change date. Swapping in "Last Change Date" for "Last Refresh Date" resulted in an error:

"A date column containing dplicate dates was specified in the call to function 'LASTDATE'. This not supported".

 

For reference, here is my original formula to calculate % of month completed:

 
% of Month Complete = CALCULATE (
DIVIDE ( day(LASTDATE('Refresh Date'[Refresh Date])), DAY ( LASTDATE ( 'Date'[Date].[Date] ) ), 0 ),
FILTER (
ALL ( 'Date' ),
YEAR ( 'Date'[Date] ) = YEAR ( TODAY () )
&& MONTH ( 'Date'[Date] ) = MONTH ( TODAY () )
)
)
 
Wondering if anyone has any ideas!
 
Thanks!
3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

I suggest to use MAXX instead of LASTDATE. Please refer to this case.

https://community.powerbi.com/t5/Desktop/FIRSTDATE-and-LASTDATE-functions-broken/td-p/417927

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
parry2k
Super User
Super User

@Anonymous can your share sample data? It is straight forward but nee to know your data model before providing any solution.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Yep, sorry about that - first time posting

 

https://1drv.ms/u/s!ApSNTjwLTv40aZkse1KKxOXARfU?e=qCbca7

 

Appreciate the quick response - let me know if you need anything else!

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.