Forum Discussion
DAX Code to connect two slicers
Please help me troubleshoot this DAX Code. I am trying to build a cashflow statement with slicers for period and date, such that when a date is selected, the period starts from that date. For example, if June 2023 is chosen in the date slicer and T3 in the period slicer, I get data for April, May, and June 2023. I have written this DAX code for the period slicer and the date slicer uses a date table. I am getting this error on using selectedvalue.
When I use max('Cash Flow'[DateFormatted]), there is no error but period does not shift based on the date selected i.e. if June 2023 and T3 are selected on slicers, there will be a blank because max('Cash Flow'[DateFormatted]) is May 2024 and T3 from that don't have June 2023 in it. If I select all on date and then select T3, I get March-May 2024 data
A circular dependency was detected: Date_filter_CF[Date_filter_CF], 1211b2b7-f4c3-36fa-76d1-071fa6217ab1, Date_filter_CF[Date], Date_filter_CF[Date_filter_CF].
Date_filter_CF =
VAR _current= SELECTEDVALUE('Date Table'[Date])
VAR _Inception= min('Cash Flow'[DateFormatted])
RETURN
UNION(
ADDCOLUMNS(
CALENDAR(EOMONTH(_current,-11), _current)
,"filter", "T12"
,"Order",0),
ADDCOLUMNS(
CALENDAR(EOMONTH(_current,-5), _current)
,"filter", "T6"
,"Order",1),
ADDCOLUMNS(
CALENDAR(EOMONTH(_current,-2), _current)
,"filter", "T3"
,"Order",2),
ADDCOLUMNS(
CALENDAR(EOMONTH(_current,-23), EOMONTH(_current,-12))
,"filter", "Previous T12"
,"Order",3),
ADDCOLUMNS(
CALENDAR(_Inception,_current)
,"filter", "Inception to Date"
,"Order",3)
)
2 Replies
- lbendlinSuper User
You cannot/should not create calculated tables from filter choices. Instead, create a static reference table with your periods.
Or - teach your users how to use the relative date filters on the filter pane.