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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.