Forum Discussion
Based on Invoice Date filter, create two separate columns
- 4 years ago
Dear apatwal
Columns do not have access to the filter context and hence cannot read any filter. However, you can achieve the same by creating two measures as the values of a matrix visual sliced by transaction number or any other column.
Supposing that the date filter will come only from the slicer (meaning it is not part of the visual) then the first measure can be:Net Change in Cost $ - Full Date = CALCULATE ( SUM ( 'Table'[Net Change in Cost $] ), ALLSELECTED ( 'Table'[Invoice Date] ) )For the 2nd measure try
Net Change in Cost $ - Last 4 Weeks = VAR EndtDate = MAX ( 'Table'[Invoice Date] ) VAR StartDate = EndtDate - 28 VAR Result = CALCULATE ( SUM ( 'Table'[Net Change in Cost $] ), FILTER ( 'Table', 'Table'[Invoice Date] < EndtDate && 'Table'[Invoice Date] >= StartDate ) ) RETURN ResultPlease let me know if works. If so kindly mark my reply as accepted solution. Thank you!
Hi tamerj1
Thanks for your reply!
I have created below two DAX measure:
1st Measure:
Net Change in Cost $ - Full Date Range =
var startdate = MIN('table'[Date])
var enddate= MAX('table'[Date])
RETURN
CALCULATE( SUM(table[Net Change in Cost $]),
DATESBETWEEN('table'[Date],startdate,enddate) )
2nd Measure:
Net Change in Cost $ Last 4 Wks =
var startday = MAX('table'[Date])-28
var endday = MAX('table'[Date])
return CALCULATE( SUM('table'[Net Change in Cost $]),
DATESBETWEEN('table'[Date],startday,endday) )
The Date is coming from Date Slicer created in report.
Let me know if I am missing out something here.