Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I encounter a problem where I cannot flag with value of 1 all previous months up until current (included).
My measure is rather simple
Solved! Go to Solution.
Ha, works but no idea why mine code does not.. Do you know how to make the lenght of the slicer only for consecutive 5 years? so from 2018 till current month, I have data from 90's included
That's because you were working on month and year columns whereas he is using the date column.
Just add to that column: =
Flag =
IF('Date_Table'[Date] <=EOMONTH(TODAY(),0)
&& YEAR('Date_Table'[Date]) >= YEAR(TODAY())-5
,1
,0)
@Pbiuserr , Create a measure as below and use it as visual level filter on slicer:-
_filter_year =
VAR _year =
YEAR ( TODAY () )
VAR _month =
MONTH ( TODAY () )
VAR _day =
DAY ( TODAY () )
VAR _date =
DATE ( _year - 5, _month, _day ) + 1
RETURN
IF (
SELECTEDVALUE ( 'Date_Table'[Date] ) >= _date
&& SELECTEDVALUE ( 'Date_Table'[Date] ) <= TODAY (),
1,
0
)
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
60 | |
58 | |
54 | |
36 | |
33 |
User | Count |
---|---|
79 | |
66 | |
45 | |
45 | |
43 |