Forum Discussion
Vioneli
9 months agoNew Member
UDF question
Hi, Can anyone help me figure out what’s causing the error when I convert this measure into a UDF? Error: DEP_P = ppct('2. FU_KIDS','2. FU_KIDS'[volume],'2. FU_KIDS'[N_FU_DEP_NMISS_C_3]) The COUN...
- 9 months ago
Hi Vioneli ,
You need to define what type of input you have for each value try the following:
FUNCTION ppct=(vtable: anyref , volumeColumn: anyref, groupColumn: anyref) => DIVIDE ( COUNTA ( volumeColumn ), CALCULATE ( COUNTA ( volumeColumn ), ALLSELECTED ( vtable ), VALUES ( groupColumn ) ) )Check the types in the documentation:
https://learn.microsoft.com/en-us/dax/best-practices/dax-user-defined-functions#type
MFelix
9 months agoSuper User
Hi Vioneli ,
You need to define what type of input you have for each value try the following:
FUNCTION ppct=(vtable: anyref , volumeColumn: anyref, groupColumn: anyref) =>
DIVIDE ( COUNTA ( volumeColumn ), CALCULATE ( COUNTA ( volumeColumn ), ALLSELECTED ( vtable ), VALUES ( groupColumn ) ) )
Check the types in the documentation:
https://learn.microsoft.com/en-us/dax/best-practices/dax-user-defined-functions#type