Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi,
I have a slicer with YYYYMM values and it contains data for multiple years and new data is loaded each month. Currently as per requirement I have manually selected latest 12 months( From 202109 to 202208) and published the report. I need to automate this, in this case once 202209 data is loaded in report slicer automatically picks new recent 12 months i.e., from 202110 to 202209. Please help me on this or any work around.
Tagging some of the known experts : @amitchandak @Greg_Deckler @parry2k
Solved! Go to Solution.
Hi @Anonymous ,
Please try this custom visual:
And use measure like this as the Pre selection:
_Month =
VAR __Month_1 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-1,1), "YYYYMM")
VAR __Month_2 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-2,1), "YYYYMM")
VAR __Month_3 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-3,1), "YYYYMM")
VAR __Month_4 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-4,1), "YYYYMM")
VAR __Month_5 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-5,1), "YYYYMM")
VAR __Month_6 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-6,1), "YYYYMM")
VAR __Month_7 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-7,1), "YYYYMM")
VAR __Month_8 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-8,1), "YYYYMM")
VAR __Month_9 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-9,1), "YYYYMM")
VAR __Month_10 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-10,1), "YYYYMM")
VAR __Month_11 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-11,1), "YYYYMM")
VAR __Month_12 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-12,1), "YYYYMM")
VAR __SelectedMonth = SELECTEDVALUE('Date'[Year Month])
RETURN
__SelectedMonth IN {__Month_1,__Month_2,__Month_3,__Month_4,__Month_5,__Month_6,__Month_7,__Month_8,__Month_9,__Month_10,__Month_11,__Month_12}
result:
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Hi @Anonymous ,
Please try this custom visual:
And use measure like this as the Pre selection:
_Month =
VAR __Month_1 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-1,1), "YYYYMM")
VAR __Month_2 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-2,1), "YYYYMM")
VAR __Month_3 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-3,1), "YYYYMM")
VAR __Month_4 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-4,1), "YYYYMM")
VAR __Month_5 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-5,1), "YYYYMM")
VAR __Month_6 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-6,1), "YYYYMM")
VAR __Month_7 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-7,1), "YYYYMM")
VAR __Month_8 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-8,1), "YYYYMM")
VAR __Month_9 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-9,1), "YYYYMM")
VAR __Month_10 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-10,1), "YYYYMM")
VAR __Month_11 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-11,1), "YYYYMM")
VAR __Month_12 = FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-12,1), "YYYYMM")
VAR __SelectedMonth = SELECTEDVALUE('Date'[Year Month])
RETURN
__SelectedMonth IN {__Month_1,__Month_2,__Month_3,__Month_4,__Month_5,__Month_6,__Month_7,__Month_8,__Month_9,__Month_10,__Month_11,__Month_12}
result:
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
@Anonymous , No(we need work around), we have to create a text like the last 12 months and use that in the selection and that will change automatically
a new column in table
lasr 12 Months Type = Switch( True(),
([Date]) >= eomonth(Today(),-11) && Date([Date])<= eomonth(Today(),0) ,"Last 12 Months" , //Last Month // or use -12
([Date])= eomonth(Today(),0),"Other Months" , //This Month
[Month Year]
)
User | Count |
---|---|
143 | |
71 | |
69 | |
53 | |
52 |
User | Count |
---|---|
208 | |
94 | |
64 | |
60 | |
57 |