Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi
I have a requirment i have 10 years of data 2012 to 2021 data but my requreiment is my year filter should be dynamic to last two years.
Now it should be default to 2020 and 2021
after getting 2022 year, my default filter should to 2021 and 2022
How to do this dynamically for filtering the page for two last years dynamically?
Thanks,
Ramss
Solved! Go to Solution.
Supposing you have a date table and a fact table,
then create the measure and put the measure into Filters
Measure =
var _Isfiltered=ISFILTERED(dateTable[Year])
var _maxYearinData=YEAR(CALCULATE(MAX(factTable[Date]),ALL(factTable)))
var _selectedYear=MIN(dateTable[Year])
return
IF(_Isfiltered,IF(YEAR(MIN(factTable[Date]))<=_selectedYear&&YEAR(MIN(factTable[Date]))>=_selectedYear-1,1,0),IF(YEAR(MIN(factTable[Date]))<=_maxYearinData&&YEAR(MIN(factTable[Date]))>=_maxYearinData-1,1,0))
result
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Supposing you have a date table and a fact table,
then create the measure and put the measure into Filters
Measure =
var _Isfiltered=ISFILTERED(dateTable[Year])
var _maxYearinData=YEAR(CALCULATE(MAX(factTable[Date]),ALL(factTable)))
var _selectedYear=MIN(dateTable[Year])
return
IF(_Isfiltered,IF(YEAR(MIN(factTable[Date]))<=_selectedYear&&YEAR(MIN(factTable[Date]))>=_selectedYear-1,1,0),IF(YEAR(MIN(factTable[Date]))<=_maxYearinData&&YEAR(MIN(factTable[Date]))>=_maxYearinData-1,1,0))
result
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
@ramshoney1225 , You need to create this type of column in your year/date table and use that
if([Year] >= year(Today())-1 && [Year] <= year(Today()) , "Last two year" , [Year] )
Default Date Today/ This Month / This Year: https://www.youtube.com/watch?v=hfn05preQYA&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=35
User | Count |
---|---|
84 | |
80 | |
70 | |
47 | |
43 |
User | Count |
---|---|
108 | |
54 | |
50 | |
40 | |
40 |