Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hola
En el código en las propiedades del informe, utilizo el siguiente código:
Public Function GetDistinctSum(ByVal values As Object()) As Decimal distinctValues.Clear() For Each value In values If value.Rank = 4 Then Dim marketShare As Decimal = CDec(value.MARKET_SHARE) If Not distinctValues.Contains(marketShare) Then distinctValues.Add(marketShare) End If End If Next Dim sum As Decimal = 0 For Each val As Decimal In distinctValues sum += val Next Return sum End Function
Then I call this code as: Code.GetDistinctSum(Fields!MARKET_SHARE.Value)
I am getting below error:
There is an error on line 1 of custom code: [BC30451] 'distinctValues' is not declared. It may be inaccessible due to its protection level.
----------------------------
The definition of the report '' is invalid.
----------------------------
An error occurred during local report processing.
Hola @sandipghosh2 ,
Parece que el error se debe a que la variable distinctValues no se ha declarado. Debe declarar distinctValues como una colección para poder usarla en la función.
Hay una publicación similar para su referencia:
Resuelto: error: [BC30451] - informe paginado - Microsoft Fabric Community
Saludos
Esteban Tao
Si esta publicación ayuda, considere Acéptalo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.