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

Calculate New Revenue for a certain area that has not had any for the past 3 years from today?

Hello All

 

I am trying to show the Sum of the amount for each area and year specifically I would like to show the areas that have generated revenue this year but have not generated revenue in the past 3 year from today. I can calculate the sum of the past three years but i can seem to figure out the how to filter areas that have revenue for prior years. Here are the columns im working with,thank you!

 

thank you for any help

1 ACCEPTED SOLUTION

Hi @milkmoneymike ,

 

How about this?

 

Measure =
VAR thisyear =
    YEAR ( TODAY () )
VAR thisyearrevenue =
    CALCULATE ( SUM ( 'Table'[ExtendedAmount] ), 'Table'[Year] = thisyear )
VAR last3yearsrevenue =
    CALCULATE (
        SUM ( 'Table'[ExtendedAmount] ),
        FILTER ( 'Table', [Year] >= thisyear - 3 && [Year] < thisyear )
    )
RETURN
    IF ( ISBLANK ( last3yearsrevenue ) && NOT ( ISBLANK ( thisyearrevenue ) ), 1 )

cl.PNG

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
pranit828
Community Champion
Community Champion

HI @milkmoneymike  

If areas that have generated revenue this year

'but have not generated revenue in the past 3 year from today'

How is it possible that generated revenew this year but did not on past 3 years from today.

If we consider taday is this year it generated revenew. Past three years from today dosn't make any sense.

Please give an simple example from your data set lets say for country 

Azerbaijan

What would you expect in the new measure or column.

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

My apologies 

 

This was meant to be 

Show the revenue for current year if the past 3 years have had no revenue. So it will show any area with a revenue in 2020 and no revenue in 2019-2017.

Hi @milkmoneymike ,

 

How about this?

 

Measure =
VAR thisyear =
    YEAR ( TODAY () )
VAR thisyearrevenue =
    CALCULATE ( SUM ( 'Table'[ExtendedAmount] ), 'Table'[Year] = thisyear )
VAR last3yearsrevenue =
    CALCULATE (
        SUM ( 'Table'[ExtendedAmount] ),
        FILTER ( 'Table', [Year] >= thisyear - 3 && [Year] < thisyear )
    )
RETURN
    IF ( ISBLANK ( last3yearsrevenue ) && NOT ( ISBLANK ( thisyearrevenue ) ), 1 )

cl.PNG

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@milkmoneymike , Try with date calendar

past three year

Rolling 36 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],today,-36,MONTH))

 

Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],today,-3,Year))

 

codition  if( CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],today,-3,Year))+0 = 0 && CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31")) >0 , 1,blank())

 

or

 

if( CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],today,-3,Year))+0 = 0 && CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31")) >0 , 1,0)

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Appreciate your Kudos.

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.