Forum Discussion

Luis_Caston's avatar
Luis_Caston
Icon for Helper III rankHelper III
2 years ago

Calendar Campaings

Dear all,

I'm focused to get a calendar campaing to filter time periods ranges.

Campaigns:

  1. Cherry Winter:
    1. Months: 9,10,11,12,1,2,3.
      1. So as you can check is goingh throug two years:
        Start Year: months 9,10,11,12.
        Next year from Start Year: months 1,2,3.
        So imagine if my date picker is at this range:

        If I select Cherry winter the date picker must change to:

         

  2. Cherry Summer:
    1. Months: 4,5,6,7
    2. Year: first year of the Date Picker.
    3. So if Date Picker is filteres as follows:

       

    4. If I select Cherry Sumer must change to the next range:

I' ve testing creating a column at the calendar table by campaing that is to say, one column Cherry Summer, another one Cherry Winter but I don't know if I'm following the correct way.

 

Do you have an idea?

I add the pbix to work with: Calendarv4 

6 Replies

  • Hi Luis_Caston

     

    I've created a new column

    test =
    IF (
    AND ( Calendario[NumMonth] IN { 4, 5, 6, 7 }, Calendario[Year] = 2023 ),
    "Cherry Summer",
    IF (
    OR (
    AND ( Calendario[NumMonth] IN { 1, 2, 3 }, Calendario[Year] = 2024 ),
    AND ( Calendario[NumMonth] IN { 9, 10, 11, 12 }, Calendario[Year] = 2023 )
    ),
    "Cherry Winter"
    )
    )

     

    After on ly side it works when I choose winter or summer choice

    • Luis_Caston's avatar
      Luis_Caston
      Icon for Helper III rankHelper III

      Hi JamesFR06 !!

      Good idea!!!

      That's exactly what I'm looking for becasue changes the Date Picker.
      One thing do you know how can I make it dynamic? Because now years are fixed.

      I'm thinking to add for example a Year filter and replace your formula as follows:

       

      test =
      IF (
      AND ( Calendario[NumMonth] IN { 4, 5, 6, 7 }, Calendario[Year] = Calendario[Year]),//because I've filtered by 2023
      "Cherry Summer",
      IF (
      OR (
      AND ( Calendario[NumMonth] IN { 1, 2, 3 }, Calendario[Year] =  Calendario[Year]+1),//because I've filtered by 2023
      AND ( Calendario[NumMonth] IN { 9, 10, 11, 12 }, Calendario[Year] = Calendario[Year] )//because I've filtered by 2023
      ),
      "Cherry Winter"
      )
      )

      If I select for example 2.022 would be 2.022 as year and 2.023 year +1.
      But my formula doesn´t works.
      Just in case link to the pbix: Calendarv4 

      • JamesFR06's avatar
        JamesFR06
        Icon for Resolver IV rankResolver IV

        Luis

         

        In your formula I do not see where you store the value of your year choice.

        So try

        SelectedYear=Selectedvalue(Calendario[Year])

         

        and after in your formula for exemple change as below :

        Instead of :

        AND ( Calendario[NumMonth] IN { 1, 2, 3 }, Calendario[Year] =  Calendario[Year]+1)

        Make this

        AND ( Calendario[NumMonth] IN { 1, 2, 3 }, Calendario[Year] =  SelectedYear+1)

  • ok I have changed your formula

    test =

    var _selecteyear = Calendario[Year]
    RETURN

    IF (
    AND ( Calendario[NumMonth] IN { 4, 5, 6, 7 },  Calendario[Year] = _selecteyear),
    "Cherry Summer"&" "&_selecteyear,
    IF (
    OR (
    AND ( Calendario[NumMonth] IN { 1, 2, 3 },  Calendario[Year] = _selecteyear+1),
    AND ( Calendario[NumMonth] IN { 9, 10, 11, 12 },  Calendario[Year] = _selecteyear)
    ),
    "Cherry Winter"&" "&_selecteyear
    )
    )
    • Luis_Caston's avatar
      Luis_Caston
      Icon for Helper III rankHelper III

      Hi JamesFR06 !
      Again thank you!
      Now when I select one year at the filter appears the campaings related to the year - what is easy to manage - but the problem is that the campaing that start one year and rolling up to the next one is stuck at the year that you have selectec, that is to say if you select 2.023 at the year filter the campaing that goes from months 9,10,11,12 from 2.023 and continuos to the months 1,2,3 of 2.024 remains stuck at 31.12.23.

       

      I add the pbix: CalendarV4