Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rajendraongole1
Post Prodigy
Post Prodigy

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

1 ACCEPTED SOLUTION

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"

Capture.PNG

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @rajendraongole1  ,

Please share sample data, or your .pbix file

 

Thank you

Robin

Hi

 

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

.

monthmonth

 

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"

Capture.PNG

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.