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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors