Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
in Excel, there's a handy function called CHISQ.TEST, which returns the value from the chi-squared (χ2) distribution for the statistic and the appropriate degrees of freedom.
I saw that many CHISQ-* functions are available in DAX (as shown on this Excel comparisation page), but the CHISQ.TEST function seems not to be available in DAX. We are specifically looking for this function, since we have a actual_range and expected_range in our dataset, and want to show the level of significance for differences (at <0.05).
In Excel, we do get the desired result, but I'm struggling to get the same result in DAX:
Any help would be greatly appreciated!
Solved! Go to Solution.
Since I don't know how your dimensions and data is set up, it's hard to write a formula for your situation but here's how I'd duplicate the calculation from the CHISQ.TEXT documentation you've linked.
Setup:
Gender | Description | Actual | Expected |
Men | Agree | 58 | 45.35 |
Men | Neutral | 11 | 17.56 |
Men | Disagree | 10 | 16.09 |
Women | Agree | 35 | 47.65 |
Women | Neutral | 25 | 18.44 |
Women | Disagree | 23 | 16.91 |
DAX:
ChiSqTest =
VAR ChiStat =
SUMX ( Survey, ( Survey[Actual] - Survey[Expected] ) ^ 2 / Survey[Expected] )
VAR DegreesFreedom =
( DISTINCTCOUNT ( Survey[Gender] ) - 1 ) * ( DISTINCTCOUNT ( Survey[Description] ) - 1 )
RETURN
CHISQ.DIST.RT ( ChiStat, DegreesFreedom )
Since I don't know how your dimensions and data is set up, it's hard to write a formula for your situation but here's how I'd duplicate the calculation from the CHISQ.TEXT documentation you've linked.
Setup:
Gender | Description | Actual | Expected |
Men | Agree | 58 | 45.35 |
Men | Neutral | 11 | 17.56 |
Men | Disagree | 10 | 16.09 |
Women | Agree | 35 | 47.65 |
Women | Neutral | 25 | 18.44 |
Women | Disagree | 23 | 16.91 |
DAX:
ChiSqTest =
VAR ChiStat =
SUMX ( Survey, ( Survey[Actual] - Survey[Expected] ) ^ 2 / Survey[Expected] )
VAR DegreesFreedom =
( DISTINCTCOUNT ( Survey[Gender] ) - 1 ) * ( DISTINCTCOUNT ( Survey[Description] ) - 1 )
RETURN
CHISQ.DIST.RT ( ChiStat, DegreesFreedom )
Dear AlexisOlson,
That is brilliant! It does exactly what we want! No need for a built-in CHITEST function when we can write it in DAX this way 🙂 Thank you very much 👍
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
23 | |
11 | |
10 | |
9 | |
7 |