Forum Discussion
Anonymous
4 years agoNot applicable
Creating a dynamic date filter for the current day
Hi! I am having trouble with the date filter I have created. It is dynamically made with DAX commands to filter data according to the current date. I have attached a sample power bi fil...
- 4 years ago
Hi, Anonymous ;
You could create a flag measure.
flag = var _max=CALCULATE(MAX('data'[date]),ALL('data')) var _year= IF(MAX('FilterYear_Table'[Disp Year])="Today’s Year",YEAR(_max), CONVERT(MAX('FilterYear_Table'[Disp Year]),INTEGER)) var _month= IF(MAX('FilterMonth_Table'[Disp Month])="Today’s Month",MONTH(_max),MONTH( MAX('FilterMonth_Table'[Disp Month]) & " 1")) var _day= IF(MAX('FilterDay_Table'[Disp Day])="Today’s Day",DAY(_max),CONVERT(MAX('FilterDay_Table'[Disp Day]),INTEGER)) return IF(MAX([date])<=DATE(_year,_month,_day),1,0)Then apply it into filter.
The final output is shown below:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yalanwu-msft
Community Support
4 years agoHi, Anonymous ;
You could create another measure.
count = COUNTROWS( SUMMARIZE(FILTER('data',[flag]=1),[date],[name]))
The final output is shown below:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.