Forum Discussion

Ashik008's avatar
Ashik008
Frequent Visitor
2 years ago
Solved

Next 12 month including current month

Hi all good day to everyone .

I need to create a measure or column to act as filter to show only the current month and next 12 months 

plese help me with it

  • Hi,

     

    Then I recommend to have a date table, if you dont have it already.

    This is a Smooth tool to use for creating it:

    https://www.sqlbi.com/tools/bravo-for-power-bi/

    Then you can create a new relative month column:

    RelativeMonth =
    DATEDIFF(
    DATE(YEAR('DateTable'[Date]), MONTH('DateTable'[Date]), 1),
    DATE(YEAR(TODAY()), MONTH(TODAY()), 1),
    MONTH
    )

     

    Then you can use this as filter greater or equal to 0 and less or equal to 12

     

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Ashik008 ,

     

    Thanks for the reply from mariussve1, please allow me to provide another insight: 

     

    Method one:
    You can set the filter type to relative date and then set the next 12 months.

     

    Method two:
    You can create measure to get the dates from this month to the next 12 months.

    Measure =
    VAR _today = TODAY()
    VAR _start = EOMONTH(_today,-1) + 1
    VAR _end = EOMONTH(_today, 12)
    RETURN
    IF(MAX('DAX DateTable'[Date]) >= _start && MAX('DAX DateTable'[Date]) <= _end, 1)

     

    Then filter the data with a measure value of 1 in the filter.

     

    If your Current Period does not refer to this, please clarify in a follow-up reply.

     

    Best Regards,

    Clara Gong

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

2 Replies

  • Hi,

     

    Then I recommend to have a date table, if you dont have it already.

    This is a Smooth tool to use for creating it:

    https://www.sqlbi.com/tools/bravo-for-power-bi/

    Then you can create a new relative month column:

    RelativeMonth =
    DATEDIFF(
    DATE(YEAR('DateTable'[Date]), MONTH('DateTable'[Date]), 1),
    DATE(YEAR(TODAY()), MONTH(TODAY()), 1),
    MONTH
    )

     

    Then you can use this as filter greater or equal to 0 and less or equal to 12

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Ashik008 ,

     

    Thanks for the reply from mariussve1, please allow me to provide another insight: 

     

    Method one:
    You can set the filter type to relative date and then set the next 12 months.

     

    Method two:
    You can create measure to get the dates from this month to the next 12 months.

    Measure =
    VAR _today = TODAY()
    VAR _start = EOMONTH(_today,-1) + 1
    VAR _end = EOMONTH(_today, 12)
    RETURN
    IF(MAX('DAX DateTable'[Date]) >= _start && MAX('DAX DateTable'[Date]) <= _end, 1)

     

    Then filter the data with a measure value of 1 in the filter.

     

    If your Current Period does not refer to this, please clarify in a follow-up reply.

     

    Best Regards,

    Clara Gong

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