March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
I have only started to use Power BI recently and have been having a lot of fun with it. However I have hit a snag with one of the visuals I have been trying to create and looking for some guidance please.
I am trying to re-create in power BI something that an ex colleague had done in excel. It takes input from a spreadsheet and calculates and outputs the total MRR on a monthly basis that is then also rolled up to a quarterly and yearly basis. See below:
The source data looks like this:
I did have some success in my research and found an example where someone had done something similiar for a HR purpose of tracking number of people. So using that as an example I created a dates table and added two relationships. What was a bit odd was that when one of those was active I got some strange results but with both inactive it looks better.
I then created the following measure:
Solved! Go to Solution.
The general pattern for getting the total to be calculated as the sum of the rows is to do a SUMX over the VALUES of the column you are using in the rows of the matrix.
MRR Revenue =
SUMX (
VALUES ( 'Dates2'[Month Year] ),
CALCULATE (
SUM ( TblCombined[MRR ($)] ),
TblCombined[Calculated End Date] > MAX ( 'Dates2'[Date] ),
TblCombined[(estimated) (billing) start date] <= MAX ( 'Dates2'[Date] ),
TblCombined[PON/Other] IN { "PON", "Excluded" }
)
)
I tweaked your code to conform to some best practices. Never use FILTER on an entire table, just filter the columns that you need to. You can get this behaviour by passing filter conditions directly into CALCULATE without using the FILTER function.
That is outstanding, thanks very much!
The general pattern for getting the total to be calculated as the sum of the rows is to do a SUMX over the VALUES of the column you are using in the rows of the matrix.
MRR Revenue =
SUMX (
VALUES ( 'Dates2'[Month Year] ),
CALCULATE (
SUM ( TblCombined[MRR ($)] ),
TblCombined[Calculated End Date] > MAX ( 'Dates2'[Date] ),
TblCombined[(estimated) (billing) start date] <= MAX ( 'Dates2'[Date] ),
TblCombined[PON/Other] IN { "PON", "Excluded" }
)
)
I tweaked your code to conform to some best practices. Never use FILTER on an entire table, just filter the columns that you need to. You can get this behaviour by passing filter conditions directly into CALCULATE without using the FILTER function.
Not sure if follow ups were allowed or if it should be a new post but thought I would try.
I tried to do the same thing with NRR:
NRR Revenue =
SUMX (
VALUES ( 'Dates2'[Month Year] ),
CALCULATE (
SUM ( TblCombined[NRR ($)] ),
TblCombined[Calculated End Date] >= MAX ( 'Dates2'[Date] ),
TblCombined[(estimated) (billing) start date] <= MAX ( 'Dates2'[Date] ),
TblCombined[PON/Other] IN { "PON", "Excluded" }
)
)
And then did a Total Revenue Measure:
Total Revenue = [MRR Revenue]+[NRR Revenue]
What I got was good but also a bit strange:
MRR looks about right although the MRR for the year is less than the MRR for the total of the 12 months of the year.
The inidividual NRR values lok about right but the total isn't correct and on the year table its both wrong and different to the total of the month column.
Any idea on what could be causing this please?
Thans
I think that the relationship between date and the billing start date might be causing problems. As the measures already factor in the appropriate logic for that try making the relationship inactive.
Unfortunately they already were inactive. I just tried completing removing the relationships but still no joy.
Hold out.
I might have sorted it. I have started duplicating the tables and creating new measures so its fresh without any dependenices and it has started to look better. Will update once complete.
Thanks
That got me closer. Now my totals correspond to each other but I can't seen to get the yearly total to be a sum of the NRR's.
Can't immediately see what the problem is. Can you share a PBIX with any confidential info removed ? You could upload to OneDrive or Google Drive or similar.
Yeah I had the same thought. I will re-build it with demo data and see how that goes then upload the PBIX.
I am away with work today so might take a few days.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
127 | |
81 | |
59 | |
59 | |
44 |
User | Count |
---|---|
182 | |
114 | |
82 | |
67 | |
52 |