Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi Experts
i am trying to clean up my dax code into something more managable. not sure if it is possible to reduce the number of lines in the following code
FROM
Can you explain what you are trying to achieve?
Can you share sample data and sample output. If possible please share a sample pbix file after removing sensitive information.Thanks.
Proud to be a Datanaut My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
Hi Expert
I am just trying up the dax measure into a sorter formula.
Hi , @Anonymous
These two formulas seem to be equivalent .
Are the results returned by both formulas the same?
If possible , can you show me the results here?
Best Regards,
Community Support Team _ Eason
Hi Team Eason
i am trying to consolidate a few measure into one larger measure using variable but i am getting an error on Var __freq... is not recongised in Var __se
Measure 1 =
VAR __freq =
SUMX (
GROUPBY (
ADDCOLUMNS (
VALUES ( PMS_FINANCIAL_PDS[Month Start] ),
"CountComplaints", CALCULATE ( COUNTROWS ( PMS_COMPLAINT ) )
),
[CountComplaints],
"__ties", COUNTX ( CURRENTGROUP (), [Month Start] )
),
IF (
[__ties] - 1 = 0,
0,
[__ties] - 1 * ( [__ties] - 1 + 1 ) * ( 2 * [__ties] - 1 + 7 )
)
)
VAR __n =
DISTINCTCOUNT ( PMS_FINANCIAL_PDS[Month Start] )
VAR __se =
SQRT ( ( [__n] * ( [__n] - 1 ) * ( 2 * [__n] + 5 ) - [__freq] ) / 18 )
VAR __S =
SUMX (
ADDCOLUMNS (
VALUES ( PMS_FINANCIAL_PDS[Month Start] ),
"CountComplaints", CALCULATE ( COUNTROWS ( PMS_COMPLAINT ) ),
"Index", RANKX ( PMS_FINANCIAL_PDS, PMS_FINANCIAL_PDS[Month Start],,, DENSE )
),
SUMX (
ADDCOLUMNS (
VALUES ( PMS_FINANCIAL_PDS[Month Start] ),
"CountComplaints", CALCULATE ( COUNTROWS ( PMS_COMPLAINT ) ),
"Index", RANKX ( PMS_FINANCIAL_PDS, PMS_FINANCIAL_PDS[Month Start],,, DENSE )
),
IF (
[Index] > EARLIER ( [Index] )
&& [CountComplaints] < EARLIER ( [CountComplaints] ),
1,
IF (
[Index] > EARLIER ( [Index] )
&& [CountComplaints] > EARLIER ( [CountComplaints] ),
-1
)
)
)
)
VAR __zstat =
IF (
[__S] > 0,
( [__S] - 1 ) / [__se],
IF ( [__S] < 0, ( [__S] + 1 ) / [__se], 0 )
)
RETURN
2 * NORM.S.DIST(-ABS(__zstat),TRUE)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!