Forum Discussion

rajendraongole1's avatar
rajendraongole1
Icon for Super User rankSuper User
6 years ago
Solved

Current month -1 in filter

Hi 

 

I am using filter slicer for date yyyy_mm by representing continously from 1st month to current month -1.

 

2019-01-01 2019-02-01 2019-03-01 2019-04-01 2019-05-01 2019-06-01 2019-07-01 2019-08-01 2019-09-01 

 

as like above but i want to highlight only currentmonth-1.

 

is there any possible way to select the current month -1 by default?

 

Please suggest.

 

Regards,

Rajendra

  • v-frfei-msft's avatar
    v-frfei-msft
    6 years ago

    Hi rajendraongole1

     

    You can't do this directly in the report designer, but you should be able to do some modelling to make it work. Here we can create a custom column in power query based on date column.

     

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtNQ3MAQipVgdGNcSlWuBwjU0AHNjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Date.IsInPreviousMonth([date]) then "Previous Month" else [date])
    in
        #"Added Custom"

     

     

3 Replies

    • rajendraongole1's avatar
      rajendraongole1
      Icon for Super User rankSuper User

      Hi

       

      Please find the attached snapshot. i am using slicer with horizontal orientation,  by default it should select month-1.

      .

      month

       

      • v-frfei-msft's avatar
        v-frfei-msft
        Icon for Community Support rankCommunity Support

        Hi rajendraongole1

         

        You can't do this directly in the report designer, but you should be able to do some modelling to make it work. Here we can create a custom column in power query based on date column.

         

         

        let
            Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtNQ3MAQipVgdGNcSlWuBwjU0AHNjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t]),
            #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}}),
            #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Date.IsInPreviousMonth([date]) then "Previous Month" else [date])
        in
            #"Added Custom"