Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Comparable sales

Hi,

I need to make a visualisation in PowerBi which compares sales of departments in 2022 and 2023, but some departments stared working before 2022, and some in mid - 2022. 
I need to see only comparable values, so if the department started working in march 2022, i have to see its sales of march - june 2022 and 2023. 
Can somebody suggest how to do this, I have departments, their sales in 2022 and 2023 and start date of departments in my table.

  • it would be great if you show us some sample data but a wild guess would be :

    i made a sample dataset my own where i have 3 companies

    company A where it starts on january 1 2022 , company B where it starts on March 1 2023 and Company C where it starts on June 1 2021

     

     

    Previous year Data = 
    SUMX( 
      VALUES(Sheet1[Date]), 
      CALCULATE( 
          [Total],
          ALLEXCEPT(Sheet1,Sheet1[Company]),
         DATEADD(Sheet1[Date],-1,YEAR)
      ) 
    )

     

     


    in short , this measure will show you the amount of your measure from same day last year

     

1 Reply

  • eliasayyy's avatar
    eliasayyy
    Memorable Member

    it would be great if you show us some sample data but a wild guess would be :

    i made a sample dataset my own where i have 3 companies

    company A where it starts on january 1 2022 , company B where it starts on March 1 2023 and Company C where it starts on June 1 2021

     

     

    Previous year Data = 
    SUMX( 
      VALUES(Sheet1[Date]), 
      CALCULATE( 
          [Total],
          ALLEXCEPT(Sheet1,Sheet1[Company]),
         DATEADD(Sheet1[Date],-1,YEAR)
      ) 
    )

     

     


    in short , this measure will show you the amount of your measure from same day last year