Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
GCM_9
Regular Visitor

Parameter Year in Virtual Table

Hello everybody
I have a table with some values ​​to display in a Segmentor and another table with some objective values.
Depending on the selected year, only the values ​​that appear in the T_Objective will be shown and if there is no record for that year, all the records of the T_DiasCierre are shown.
That seems to more or less work for me.
I have the problem when trying to retrieve the value of the year (SELECTEDVALUE(Calendar[Date].[Year])) that does not retrieve any value.

C2.JPG

finalCalc =

var anno = SELECTEDVALUE(Calendario[Date].[Año])

VAR _Filtered =

    CALCULATE(SUM(T_Objetivo[VALOR]),T_Objetivo[AÑO] = anno && T_Objetivo[AMBITO] = "USER" && T_Objetivo[INDICADOR] = "CLOSED" )

VAR calculo =    

    ADDCOLUMNS (

        GROUPBY (

            T_U_DiasCierre,

            T_U_DiasCierre[Id],

            "Valor", SUMX ( CURRENTGROUP (), [Valor] )

        ),

        "Activo", IF(ISBLANK( _Filtered), 1,IF ( [Valor] = _Filtered, 1 ))

        ,"ANNO", SELECTEDVALUE(Calendario[Date].[Año])

        ,"a_calen",anno

    )

return calculo

C1.JPG

  

C3.JPG


What can I do to solve this problem ?
I will appreciate your help 


Thanks

4 REPLIES 4
some_bih
Super User
Super User

Hi @GCM_9 usually SELECTEDVALUE is consumed when on slicer user choose some values (like specific year). It could be that on dashboard you did not do something like this so no values is retrived from slicer.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






I have a filter with the different years that we can select.
The year that we select is the one that I want to pass as a filter parameter
I'm trying to get it back   SELECTEDVALUE(Calendario[Date].[Año])  but this not retrieve any value
Also tried with   SELECTEDVALUE(Calendario[Date].[Año],MAX(CALENDARIO[año])) with the same result (NULL)

some_bih
Super User
Super User

Hi @GCM_9  try in your  finalCalc part for

   ,"ANNO", SELECTEDVALUE(Calendario[Date].[Año])

to put

,"ANNO", anno 

as you already have variable





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Hi @some_bih
     var anno = SELECTEDVALUE(Calendario[Date].[Año])    not retrieve any value
"ANNO", anno ===> NULL
I need retrieve [year] value so apply it to the filter later

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.