Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello, I thought this problem would be simple but has not been and no example I could find (Dax Patterns, EnterpriseDNA, PPPs love you all) seems to deal with this scenario.
We run a subscription business and invoice our customers once per month.
How do I calculate with DAX the total $ growth in customer invoicing this month compared to last month only for customers whose total invoicing this month is greater than their total last month? (This is easy on a customer by customer basis, but I want it on a total basis). I have a standard total invoicing table with unique customer id linked to a calendar table by invoice date.
Any help would be much appreciated.
Solved! Go to Solution.
Hi @SteveCnz
Here's one way of doing it.
I'm going to assume you have a table called Invoices with columns Customer ID, Invoice Date, Amount.
As per your description, I'll assume Invoices[Invoice Date] is related to 'Calendar'[Date].
Then I would create the following measures (some of which you probably already have):
Invoice Amount = SUM ( Invoices[Amount] ) Invoice Amount Month Ago = CALCULATE ( [Invoice Amount], DATEADD ( 'Calendar'[Month], -1, MONTH ) ) Invoice Amount Growth = [Invoice Amount] - [Invoice Amount Month Ago] Invoice Amount Growth Increases Only = SUMX ( VALUES ( Invoices[Customer ID] ), MAX ( BLANK(), [Invoice Amount Growth] ) )
The last measure iterates through Customers and sums the growth only for the Customers who have increased.
Regards,
Owen
Hi @SteveCnz
Here's one way of doing it.
I'm going to assume you have a table called Invoices with columns Customer ID, Invoice Date, Amount.
As per your description, I'll assume Invoices[Invoice Date] is related to 'Calendar'[Date].
Then I would create the following measures (some of which you probably already have):
Invoice Amount = SUM ( Invoices[Amount] ) Invoice Amount Month Ago = CALCULATE ( [Invoice Amount], DATEADD ( 'Calendar'[Month], -1, MONTH ) ) Invoice Amount Growth = [Invoice Amount] - [Invoice Amount Month Ago] Invoice Amount Growth Increases Only = SUMX ( VALUES ( Invoices[Customer ID] ), MAX ( BLANK(), [Invoice Amount Growth] ) )
The last measure iterates through Customers and sums the growth only for the Customers who have increased.
Regards,
Owen
I have use the same fomula for downgrade and its work for me but the problem I find that by using SumX(Values(Customer ID),Min(Blank(), [Invoice growth])) is I am not getting last month new users who did not pay invoice in current month.
Hi,
Does this measure work?
=SumX(CALCULATETABLE(Values(Customer ID),DATESBETWEEN(Calendar[Date],EDATE(MIN(Calendar[Date]),-1),MAX(Calendar[Date]))),Min(Blank(), [Invoice growth]))
Ideally we should have a separate Customer dimension table to iterate over. This would ensure that all customers are considered whether or not they are present in the current filter context.
So the measure should be something like:
=
SUMX (
VALUES ( Customer[Customer ID] ),
MIN ( BLANK (), [Invoice growth] )
)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
76 | |
52 | |
39 | |
35 |
User | Count |
---|---|
92 | |
67 | |
54 | |
52 | |
46 |