The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Solved! Go to Solution.
Your formula doesn't look too bad, but only as a calculated table which is what CALENDAR is meant for.
I assume both your Sales table and your Forecast table have a [Date] column? First, the best practice is to put the table name before the column name in a formula, so
CALENDAR( MINX(Sales, Sales[Date]), MAXX(Forecast, Forecast[Date]))
In fact, this can be written in a simpler way by not using the table functions MINX and MAXX, but the basic aggregations:
CALENDAR(MIN(Sales[Date]), MAX(Forecast[Date]))
If the last line is the code you're trying to use, the problem there is that MINX expects a scalar value for each row in the table (User_Xref in your case) which is calculated through the expression you provide. This expression is:
FILTER(User_Xref, [LastDT] <> BLANK())
but FILTER returns a subset of the User_Xref table, which probably contains multiple columns. Poor MINX wouldn't know what to compare to what here (even if the table has one column, you would provide multiple rows which wouldn't work either)
Your formula doesn't look too bad, but only as a calculated table which is what CALENDAR is meant for.
I assume both your Sales table and your Forecast table have a [Date] column? First, the best practice is to put the table name before the column name in a formula, so
CALENDAR( MINX(Sales, Sales[Date]), MAXX(Forecast, Forecast[Date]))
In fact, this can be written in a simpler way by not using the table functions MINX and MAXX, but the basic aggregations:
CALENDAR(MIN(Sales[Date]), MAX(Forecast[Date]))
If the last line is the code you're trying to use, the problem there is that MINX expects a scalar value for each row in the table (User_Xref in your case) which is calculated through the expression you provide. This expression is:
FILTER(User_Xref, [LastDT] <> BLANK())
but FILTER returns a subset of the User_Xref table, which probably contains multiple columns. Poor MINX wouldn't know what to compare to what here (even if the table has one column, you would provide multiple rows which wouldn't work either)
Using this code
CALENDAR(MIN(Sales[Date]), MAX(Forecast[Date]))
is closer but now results in this error:
A table of multiple values was supplied where a single value was expected.
Your code starting with 'Test_Column =' suggests that you're trying to create a calculated column, for which the formula should always return a scalar value. CALENDAR returns a table.
Tough to say, something wonky with your data? Not actual date fields? I recreated this and had no issues. See attached, Sales, Forecast and Table.
Weird, I'd try CALENDARAUTO()
User | Count |
---|---|
28 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
35 | |
14 | |
12 | |
9 | |
7 |