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
StaceyG
Helper I
Helper I

Determine when credits will run out

Hello all you brilliant minds,

 

I have pre-purchased credits with Fivetran and Snowflake.  I need to write a calculation to determine when the credits will run out based on the run rate.  The .pbix found here contains usage data.  Any suggestions on how to calculate when credits for each system will reach zero?

 

Thanks!

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Here is the run-out projection

lbendlin_1-1627064950972.png

Run Out := 
var d = max('Date'[Date])
var c = CALCULATE(sum('Credit Purchase'[Credits]),REMOVEFILTERS('Date'[Date]))
var di = [CM]-CALCULATE([CM],'Date'[Date]=d-14)
return d+14*divide(c-[cm],di)

CM := 
var d=max('Date'[Date])
return calculate(sum('Usage To Date'[Credits Used]),'Date'[Date]<=d)

View solution in original post

9 REPLIES 9
v-shex-msft
Community Support
Community Support

Hi @StaceyG,

Did lbendlin 's suggestions help with your scenario? if that is the case, you can consider Kudo or accept the helpful one to help others who faced similar requirements to find it more quickly.

If these also don't help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
lbendlin
Super User
Super User

Here is the run-out projection

lbendlin_1-1627064950972.png

Run Out := 
var d = max('Date'[Date])
var c = CALCULATE(sum('Credit Purchase'[Credits]),REMOVEFILTERS('Date'[Date]))
var di = [CM]-CALCULATE([CM],'Date'[Date]=d-14)
return d+14*divide(c-[cm],di)

CM := 
var d=max('Date'[Date])
return calculate(sum('Usage To Date'[Credits Used]),'Date'[Date]<=d)
lbendlin
Super User
Super User

btw, I corrected your data model. I don't like auto date/time but I let that be your problem, it's not relevant for the discussion.

 

lbendlin_0-1627059707779.png

 

lbendlin
Super User
Super User

What about the consumption that happened before the first credit date?

StaceyG
Helper I
Helper I

@lbendlin I supposed it would help to include the credits purchased 🙂  Sorry, stripped that out when I pulled confidential data out of the file.  I've updated the pbix to include that information.

lbendlin
Super User
Super User

@StaceyG  I cannot find the prepaid amount in the data - can you please explain?

 

By the way - here's a "cheap" option to use the existing Forecast feature 

 

lbendlin_0-1627055805447.png

 

 

@lbendlin I've uploaded a new file here .  Let me know if that one works for you.  Thanks!

lbendlin
Super User
Super User

Needs more details.  What do you want to base the prediction on - the usage of the total prior period, or some part of it like the last 7 days, or the last month? You seem to have a big change in behavior since mid June?

 

lbendlin_0-1627051462331.png

 

 

 

@lbendlin Yes, we have had a big uptick in usage.  I would want to base continued rate on the previous 2 weeks run rate.

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.