Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

same period last year column

Hi,

 

I am struggling with when to use measures vs calculated columns.

 

I have 60K records of data where I am trying to calculate the change in rents (year over year ).

I have easily created measures to do this but I need to categorize these changes into

 

1) Rent Increase, Decrease or no change

2) Stratify the increases/decreases by 100 increments (0-100, 101-200)

 

When I try to create a column to calculate the same period last year I get a circular depdendcy errror. 

What I want to know is if this is how I should be doing this type of calculation and if not what a good approach would be in Power BI.

Thanks in advance. 

3 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Anonymous,

     

    With current information, I cannot imagine your table structure. Please provide some sample data and show us your desired output with simple example so that I can test for you. Also, you can show the measure formula you have created. 

     

    Regards,

    Yuliana Gu

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      The data is structured like this

       

      CustomerYearRents
      12012100
      22012105
      42013165
      52013170
      12014200

      The output would look like this

       

       

       2012 to 20132013-20142014-2015
      CustomerYear 1 ChangesYear 2 ChangesYear 3 Changes
      Rent DecreasesCount of customers with Rent Decreases  
      Rent IncreasesCount of customers with Increases  
      No Change In Rent   
          
          
      Rent Increases   
      <25Count of customers with Increases <25  
      25 to 50Count of customers with Increases 25 to 50  
      50 to 100Count of customers with Increases 50 to 100  
      100 to 200Count of customers with Increases 100 to 200  
      >200Count of customers with Increases >200  

       

      One other thing to keep in mind is that not every customer exists in every year but the concepts would stay the same.

       

      Measures Created

      Yearly Rents = sum(DATA_FOR_POWER_BI_CSV[Rent_Total])

      Total Rents Prior Year = CALCULATE([Yearly Rents],SAMEPERIODLASTYEAR(DATA_FOR_POWER_BI_CSV[Fiscal Year]))

      Year Over Year Rent Difference = if(ISBLANK([Total Rents Prior Year]),0 ,[Yearly Rents]-[Total Rents Prior Year])

       

      Thanks so much!

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous 

     

    Hi,

     

    I am trying to do something very similar to what you're doing, which is materializing the result of a measure into a column to be able to stratify/bucketize the values.  Did you ever find a solution to yours?

     

     

    Regards,

     

    Ferdinand