Forum Discussion
Fragmaticx
1 year agoFrequent Visitor
Filter 2 dates in the same table, at once
Hi I have a flat table with ShipmentDateCost and ShipmentDateSales I want to find a way to filter on those 2 dates at once. So I want to see all bought and solgt in ex. september 2024? ...
- 1 year ago
Hi Fragmaticx ,
This maybe occur because the FORMAT function is returning string, let try this upadated DAX:
IsInSelectedPeriod = VAR SelectedYearMonth = SELECTEDVALUE('DateTable'[ShipPeriod]) VAR SelectedYear = YEAR(DATEVALUE(SelectedYearMonth & "01")) VAR SelectedMonth = MONTH(DATEVALUE(SelectedYearMonth & "01")) RETURN IF( CALCULATE( COUNTROWS('BaseData'), FILTER( 'BaseData', YEAR('BaseData'[ShipmentDateSales]) = SelectedYear && MONTH('BaseData'[ShipmentDateSales]) = SelectedMonth || YEAR('BaseData'[ShipmentDateCost]) = SelectedYear && MONTH('BaseData'[ShipmentDateCost]) = SelectedMonth ) ) > 0, 1, 0 )
lukiz84
Memorable Member
1 year agoYour approach with the 2 date tables and one date-month table on top doesn't work because it only filters to values where BOTH ShipmentDateCost and ShipmentDateSales were in the same month. And I think you want to see all the values which have been ShipmentDateCost OR ShipmentDateSales have been e.g. in september?
Fragmaticx
1 year agoFrequent Visitor
Hi
yes I want to see either cost or sales in a given month.
But I would like to be able to filter on table/graphs and so on 🙂