This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hey guys,
I am struggling with how to get one challenging calculated column. I appreciate every help I can get.
This is my data set and the desired calculated column is in orange.
So, I am trying to compare Ending MRR of every customer and it's Ending MRR in the same period last year, and if the previous year Ending MRR is blank, I would need to get current Ending MRR.
Basically, I want to test is there any customer who was not active last year and is active now.
| Customer | Report Date | Ending MRR | Same period last year MRR |
| A | 2/28/2019 | 236 | |
| A | 3/31/2019 | 236 | |
| A | 4/30/2019 | 236 | |
| A | 12/31/2019 | ||
| B | 6/30/2018 | ||
| B | 7/31/2018 | ||
| B | 8/31/2018 | ||
| B | 9/30/2018 | ||
| B | 10/31/2018 | ||
| B | 11/30/2018 | ||
| B | 12/31/2018 | ||
| B | 1/31/2019 | ||
| B | 2/28/2019 | ||
| B | 3/31/2019 | ||
| B | 4/30/2019 | ||
| B | 5/31/2019 | ||
| B | 6/30/2019 | ||
| B | 7/31/2019 | ||
| B | 8/31/2019 | 316 | 316 |
| B | 9/30/2019 | 316 | 316 |
| B | 10/31/2019 | 316 | 316 |
| B | 11/30/2019 | 316 | 316 |
| B | 12/31/2019 | 316 | 316 |
| B | 1/31/2020 | 316 | 316 |
| B | 2/29/2020 | 316 | 316 |
Any help is welcome.
Thanks!
Solved! Go to Solution.
Hi @tomislav_mi ,
Try this:
Same period last year MRR =
VAR MinDateofEachCustomer =
MINX ( ALLEXCEPT ( 'Table', 'Table'[Customer] ), 'Table'[Report Date] )
VAR LastYearValue =
CALCULATE (
SUM ( 'Table'[Ending MRR] ),
ALLEXCEPT ( 'Table', 'Table'[Customer] ),
SAMEPERIODLASTYEAR ( 'Table'[Report Date] )
)
RETURN
IF (
MinDateofEachCustomer < SAMEPERIODLASTYEAR ( 'Table'[Report Date] ),
IF ( LastYearValue = BLANK (), 'Table'[Ending MRR], LastYearValue )
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @tomislav_mi ,
Try this:
Same period last year MRR =
VAR MinDateofEachCustomer =
MINX ( ALLEXCEPT ( 'Table', 'Table'[Customer] ), 'Table'[Report Date] )
VAR LastYearValue =
CALCULATE (
SUM ( 'Table'[Ending MRR] ),
ALLEXCEPT ( 'Table', 'Table'[Customer] ),
SAMEPERIODLASTYEAR ( 'Table'[Report Date] )
)
RETURN
IF (
MinDateofEachCustomer < SAMEPERIODLASTYEAR ( 'Table'[Report Date] ),
IF ( LastYearValue = BLANK (), 'Table'[Ending MRR], LastYearValue )
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you all guys, @Icey @amitchandak @Mariusz
when I combined all I have read I got sollution!
Thanks all!
Something like this
if ( isblank(CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],0,Year)) ),
CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],0,Year))
CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year)))
Hi @tomislav_mi
try SAMEPERIODLASTYEAR() function.
https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax
Hey @Mariusz ,
already tried to use it withing CALCULATE but it does not work. I could get limited solution when using it as a measure but not as a calculated column.
Hi @tomislav_mi
When using a column add ALLEXCEPT( yourtable, yourtable[customerColumn ) to you CALCULATE as an extra argument
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 30 | |
| 24 | |
| 23 | |
| 17 | |
| 15 |
| User | Count |
|---|---|
| 61 | |
| 36 | |
| 29 | |
| 22 | |
| 21 |