Forum Discussion
Two Date Columns in a slicer using DAX
- Anonymous2 years ago
Hi LME ,
Please try:Measure = VAR _min_date = MIN('Dates'[Date]) VAR _max_date = MAX('Dates'[Date]) VAR _result = CALCULATE( COUNTROWS('Table'), ('Table'[Date1]>=_min_date && 'Table'[Date1]<=_max_date) || ('Table'[Date2]>=_min_date && 'Table'[Date2]<=_max_date) ) + 0 RETURN _resultBest Regards,
Gao
Community Support TeamIf 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 in the Power BI Forum
LME , Create an independent date table and use that in slicer
//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
return
calculate( sum(Table[Value]), filter('Table', 'Table'[Date1] >=_max || 'Table'[Date2] >=_max))
Or refer, how to deal with two dates
Power BI Dax Measure- Allocate data between Range: https://youtu.be/O653vwLTUzM
HR Analytics - Employees as on Date : https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970
Power BI HR Active Employee Tenure Bucketing, and Hired, Terminated, and Active employees: https://youtu.be/fvgcx8QLqZU
- LME2 years agoFrequent Visitor
Hey again, I don't understand this formula that you have presented namely: "Date1[date]" and "Table[value]". Date1 is a column and not a table and I am not sure what you mean by value.
I am just using one table called new_companyprofile which has two date columns called "Created on" and "Updated on". I want a slicer based on the time period between a certain date and a certain date, the card visual will change with a count of how many dates occured between the two columns in that date range using the OR operator. I have visuals in there too which changes based on the slicer.
In my current slicer, I am using the "Update Date" column so it is only counting that column. I want the slicer to count both the update date and created on column. Refer to my example above. I really appreciate this!