Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am creating a custom period slicer for my report.
"Date" table is my date table and is connected with relationships to my multiple dates in multiple fact tables
"New Date" is a standalone table that has no relationships with any of my fact tables. It is
I have created a new measure "Period Filter" to filter the x-axis on a line graph visual so users can select the period.
Period Filter =
VAR _selectedperiod = SELECTEDVALUE('Last 5 Custom Period'[Period-Order])
VAR _last5qtr =
MAX('Date'[Date]) IN
FILTER('New Date', 'New Date'[Fiscal Year Quarter Offset] >= -4 && 'New Date'[Fiscal Year Quarter Offset] <= 0 && 'New Date'[Fiscal Year Week Offset] <> BLANK())
VAR _last5months =
MAX('Date'[Date]) IN
FILTER('New Date', 'New Date'[Fiscal Year Month Offset] >= -4 && 'New Date'[Fiscal Year Month Offset] <= 0 && 'New Date'[Fiscal Year Week Offset] <> BLANK())
VAR _last5wks =
MAX('Date'[Date]) IN
FILTER('New Date', 'New Date'[Fiscal Year Week Offset] >= -4 && 'New Date'[Fiscal Year Week Offset] <= 0 && 'New Date'[Fiscal Year Week Offset] <> BLANK())
RETURN
INT(SWITCH(
_selectedperiod, 1, _last5qtr,
2, _last5months,
3, _last5wks
))
The "Last 5 Custom Period" table is as follows:
I am getting the following error with the [Period Filter] measure:
"The number of arguements is invalid. Function CONTAINSROW must have a value for each column in the table expression"
I am not using the CONTAINSROW function. Any ideas on how to resolve this error and whats causing it?
Hi All,
Have you found how to fix that? As I am getting the same error and looks like below MonthToDate does not give any issues.
While below statements that has IN FILTER or IN ALL gives the issue:
Looks like the the MAX function excepts a single value but the FILTER function is returning a TABLE as the Date Dimention table has multiple columns. Below changes will solve the error.
I would try this:
VAR _tableLast5qtr =
FILTER( 'New Date', 'New Date'[Fiscal Year Quarter Offset] >= -4 &&
'New Date'[Fiscal Year Quarter Offset] <= 0 &&
'New Date'[Fiscal Year Week Offset] <> BLANK()
)
VAR _last5qtr = CONTAINS(
_tableLast5qtr,
[select the proper column to comper with],
MAX('Date'[Date])
)
Hi @dogt1225
I'm a bit late to the party, but for what it's worth:
What I note without diving to deep into the case, is that the IN syntax requires that the values listed are placed within curly brackets, and should be such as:
'Table'[ColumnA] IN {val1, val2} or 'Table'[ColumnA] IN {"A", "B"} etc. depending on the data type.
(It's explained in the link that @vicky_ gave you, i.e. The IN operator in DAX - SQLBI, scroll down to the line "With the new IN syntax, you can write: ")
This way you should hopefully (at least) get you past the CONTAINSROW error message.
Have you found a solution to this? I'm having the same problem when I try to build a similar filter.
The IN keyword is calling the containsrow function: https://www.sqlbi.com/articles/the-in-operator-in-dax/
Thanks, any ideas on how to make it a valid measure?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
97 | |
82 | |
74 | |
66 |
User | Count |
---|---|
120 | |
105 | |
99 | |
81 | |
72 |