Hello,
Does someone know how to filter a table from a created column that comes from a new variable? I'll show the measure:
--------------------------------------------------------------------------------------
VAR Dif_Hours =
Hores_Mes_Actual - Hores_Mes_Anterior
//I have a number diference = [hours this month - hours previous month] as a starting point //
VAR Numero_Feines_Incrementen =
COUNTAX(
CALCULATETABLE(
ADDCOLUMNS(
SUMMARIZE('Productivitat DIA','Productivitat DIA'[NAME]
),
"Dif_Hours123",Dif_Hours
),
Dif_Hours123>0),
'Productivitat DIA'[NAME]
)
//What I want is to use the variable Dif_Hours as a filter to COUNTAX and only count rows number of
Productivitat DIA'[NAME] that have Dif_Hours > 0. //
Of course, DAX doesn't accept the new column "Dif_Hours123" as a table name or a correct function. But I can't find a suitable alternative.
Much appreciated if you can help...
Update:
I've got something closer by applying countax after virtual table. Still result not satisfactory as it shows total of rows without filter:
Total is 11 and by filtering it should be 5.
----------------------------------------------------------
VAR Diferencia_Hores =
Hores_Mes_Actual - Hores_Mes_Anterior
VAR Taula_Dif_Hores =
CALCULATETABLE(
ADDCOLUMNS(
SUMMARIZE('Productivitat DIA','Productivitat DIA'[NAME]
),
"Dif_Hores",Diferencia_Hores
)
)
RETURN
COUNTAX(
FILTER(Taula_Dif_Hores,[Dif_Hores]>0),[Dif_Hores])