Forum Discussion
DAX Retrieve Year Value in a Virtual Table
The year value is taken from a slicer in the Calendar table
With the selected year you must create a new segmenter with only the active values
The year I am trying to retrieve with SELECTEDVALUE(Calendar[Date]. [Year]) but when you create the new virtual table you are not retrieving the selected year
finalCalc =
var anno = SELECTEDVALUE(Calendar[Date].[ Year])
VAR _Filtered =
CALCULATE(SUM(T_Objetivo[VALUE]),T_Objetivo[YEAR] = anno && T_Objetivo[SCOPE] = "USER" && T_Objetivo[INDICATOR] = "CLOSED" )
VAR calculation =
ADDCOLUMNS (
GROUPBY (
T_U_DiasCierre,
T_U_DiasCierre[id],
"Value", SUMX ( CURRENTGROUP(), [Value] )
),
"Active", IF(ISBLANK( _Filtered), 1,IF ( [Value] = _Filtered, 1 ))
,"ANNO", SELECTEDVALUE(Calendar[Date].[ Year])
,"a_calen",anno
)
return calculo
The result of the T_finalCal will be mostrarT_DiasCierre and a 1 will appear in the Active field if the value is in T_Objetivo
This is the initial approach, but I can modify it if someone gives me a good result
If there is no single year selected SELECTEDVALUE will return BLANK()