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

View all the Fabric Data Days sessions on demand. View schedule

Reply
WilliamT
Regular Visitor

Showing result of chi square test in Power BI

Hello guys,

I have been trying to show the result of chi-square test through R in Power BI.

"R script visual" didn't work and "Run R script" in "Edit Queries" didn't work either.

I searched online but I couldn't find any solution regarding this issue.

Could anyone please help me on this?

Thank you so much!

 

My 3 x 3 contingency table is like the following: 

                  Asia    Africa   America

Disease A   31         14          45

Disease B    2            5          53

Disease C   53         45           2 

4 REPLIES 4
Anonymous
Not applicable

Hi @WilliamT ,

 

Can you show your code so we can understand better of your issue?

Is your data just a 3x3 table in Power BI?

 

Thanks,

JC

@Anonymous

Thank you for your reply.

I grouped and unpivoted to a 3x3 contingency table in Power BI.

And my script at that point was just "chisq.test(dataset)" using R script.

But no error was shown but no result was shown either.

 

Thanks,

Anonymous
Not applicable

@WilliamT 

 

So you are getting empty space in the R visual after pressing "Run Script"?

Did you use any plot function to generate a graph/visual?

 

@Anonymous 

Yes, I got an empty table after "Run Script" without any error message.

And I didn't use plot function since the result of chi square is something like :

"Pearson's Chi-squared test

X-squared = 2.0396, df = 1, p-value = 0.1533"

And the p-value above is the value I need for independence test.

 

Thank you!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors