Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi guys!
I need some help with this.
I am trying to build a function that allows me to assign a given number to a day of the week and then add those amounts between two dates that can be selected according to another table context.
I have managed to make this filter, and identify in a single column the values to be summed.
VAR HORASINTERM =
SELECTCOLUMNS (
ADDCOLUMNS (
FILTER (
'Calendario académico',
'Calendario académico'[fecha] > DATE ( 2022, 04, 01 )
&& 'Calendario académico'[fecha] < TODAY ()
),
"HorasInterm",
IF (
'Calendario académico'[dia_lab] = "True",
IF ( 'Calendario académico'[dia_semana] = "6", 10, 12 ),
0
)
),
"COLUMNAF[HorasInterm2]", [HorasInterm]
)
And this is the ouput
So, I need SUM the values of this columns, but, I get the error "The SUM function only accepts a column reference as argument".
I have been reading documentation, and apparently, it is not possible because the SUM function only allows the use of a table column, and when I create a table, and assign it to a measure, it is not treated strictly as a table and therefore, there is no column to execute the sum.
P.S.: the variable will not be used to create a table, but to calculate it with other variables in the creation of a column.
Any idea how to solve it?
Thanks!
Solved! Go to Solution.
hi @andersonm
you are right. SUM cannot do that but SUMX can. You can even skip the SELECTCOLUMNS part and use
SUMX ( HORASINTERM, [HorasInterm] )
hi @andersonm
you are right. SUM cannot do that but SUMX can. You can even skip the SELECTCOLUMNS part and use
SUMX ( HORASINTERM, [HorasInterm] )