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
BruceK57
Regular Visitor

Calculate End of Month Balance

I have 20 vendors. Each vendor has a customer base. I want to calculate the customer base at the end of the month in Power Pivot / DAX. The calculation is:

 

Beginning of this month customer count (same last month end of month customer count)
Plus New Customers
Minus Dropped Customers
Equals this month end of month customer count

 

I think the way to do it is to have a calculated column in the Power Pivot table called EOM Count. The formula in this column would be:

 

EOM Count from the preceding row plus adds from current row minus drops from current row.

 

I haven't worked out the formula, I want to be sure I have the concept correct first.

 

Also, since I have multiple vendors, each with their own ID, I should be able to add the EOM Count field in my pivot table, then filter it in the pivot table when I add a vendor column. Is this correct?

 

Thank you,
Bruce

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @BruceK57,

 

According to your description, you want to get the each vendor's monthly customer count change, right?

 

If this is a case, you can use current vendor, month, year to filter table and get the count.

 

Sample: measure

 

Monthly Count=
var currVendor= LastNoBlank(Table[Vendor ID],[Vendor ID])
var currDate= Max(Table[Date])
Return
Calculate(CountA(Table[Custom]),
Filter(ALL(Table),
Table[vendor ID]=currVendor&&
Year(Table[Date])=Year(currDate)&&
Month(Table[Date])=Month(currDate)))

 

 

BTW, your logic suitable deal with the table which store the customers count with running total.

 

Current Month Count = EOM - Previous EOM

 

 

If above formula not suitable for your requirement, please share us a sample file to test.

 

Regards,

Xiaoxin Sheng

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

Thank you for your reply.  This looks like a simple answer, but I will have to study it to see how I can apply it to my model.

 

Since I have a meeting in a few days, for now I have created an Excel table that calculates the month end number.  I am bringing this table into my data model and will use it for the moment.

 

After the meeting, if the client decides to continue, I'm definitely going to have to learn new ways to make this better and may in fact offer a file for you to review.

 

Thank you,

Bruce

BruceK57
Regular Visitor

I have 20 vendors.  Each vendor has a customer base.  I want to calculate the customer base at the end of the month in Power Pivot / DAX.  The calculation is:

 

Beginning of this month customer count (same last month end of month customer count)

Plus New Customers

Minus Dropped Customers

Equals this month end of month customer count

 

I think the way to do it is to have a calculated column in the Power Pivot table called EOM Count.  The formula in this column would be:

 

EOM Count from the preceding row plus adds from this row minus drops from this row.  

 

I haven't worked out the formula, I want to be sure I have the concept correct first.

 

Also, since I have multiple vendors, each with their own ID, I should be able to add the EOM Count field in my pivot table, then filter it in the pivot table when I add a vendor column.  Is this correct?

 

Thank you,

Bruce

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