Forum Discussion
sxs58230
5 years agoFrequent Visitor
Dynamically change the data count in Power BI visual based on Date selection in slicer
Hi Everyone, I have a below explained use-case to implement, but not able to think about how we can implement it in Power BI. So, please help me out if you have any suggestions on implementing this ...
- 5 years ago
Don't forget that December has 31 days. Also note that "last 30 days" is ambiguous. Does it include the max date or not? Below formula actually covers 31 days, not 30.
Last 30 days := COUNTROWS(filter('Sample','Sample'[Login Date] in DATESINPERIOD(Dates[Date],max(Dates[Date]),-30,DAY))) 30 to 60 days := COUNTROWS(filter('Sample','Sample'[Login Date] in DATESINPERIOD(Dates[Date],max(Dates[Date])-31,-30,DAY))) Beyond 60 days := var d = max(Dates[Date]) return COUNTROWS(filter('Sample','Sample'[Login Date]<=d && DATEDIFF('Sample'[Login Date],d,DAY)>60))
lbendlin
5 years agoSuper User
Don't forget that December has 31 days. Also note that "last 30 days" is ambiguous. Does it include the max date or not? Below formula actually covers 31 days, not 30.
Last 30 days := COUNTROWS(filter('Sample','Sample'[Login Date] in DATESINPERIOD(Dates[Date],max(Dates[Date]),-30,DAY)))
30 to 60 days := COUNTROWS(filter('Sample','Sample'[Login Date] in DATESINPERIOD(Dates[Date],max(Dates[Date])-31,-30,DAY)))
Beyond 60 days := var d = max(Dates[Date])
return COUNTROWS(filter('Sample','Sample'[Login Date]<=d && DATEDIFF('Sample'[Login Date],d,DAY)>60))