Forum Discussion

Broeselchen's avatar
Broeselchen
Helper III
2 years ago
Solved

Compare campaigns

I have measure with metrics for various campaigns in PowerBI. Can I only compare certain campaigns? So, for example, a campaign that ran from March 1st to April 20th, 2023 with one that ran from March 5th to April 24th, 2024?

6 Replies

  • Uzi2019's avatar
    Uzi2019
    Community Champion

    Hi Broeselchen 

     

    Yes. you can compare the various campaigns it completly depends on how you want to show different comparison..

     

  • I need something like this:

     

    These are the differents with "sameperiod last year", absolutely and in percent. I need various periods. But without making a new measure for every period.

    • Uzi2019's avatar
      Uzi2019
      Community Champion

      hi Broeselchen 

       

      Please try this 

       

      Same Date range last period =
      var _diff = datediff(MIN('Date'[date]),max('Date'[date]),DAY)
      var _p_st_date = MINX('Date',DATEADD('Date'[date],-1*_diff,Day))-1
      var _p_end_date = MAXX('Date',DATEADD('Date'[date],-1*_diff,Day))-1
      Return
      CALCULATE(sum(Sales[Sales Amount]),all('Date'[date]),'Date'[date]>=_p_st_date && 'Date'[date]<= _p_end_date
      )

       

      I hope it may give you dynamic previous previod calculation!

       

       

  • But I don't want the "same date range last period". I need an other period in the last year then in the current year. Maybe the comparison between May 2023 and June 2024.