Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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] )
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
27 | |
13 | |
11 | |
9 | |
6 |