- Forums
- Get Help with Power BI
- Desktop
- Service
- Report Server
- Integrations with Files and Services
- Mobile Apps
- Developer
- DAX Commands and Tips
- Let's Talk Data
- Custom Visuals Development Discussion
- Community Support
- Welcome to the Community
- Community Feedback
- Community Help Blog
- Training and Consulting
- Dashboard in a Day
- EdX Specific Training Discussion Forum

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

Keelin

Regular Visitor

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-04-2018
05:15 PM

Hello all,

I am new to DAX and in need of some urgnt assistence.

I am calculating the margin of error for survey results, currently attempting to do this in steps but I cannot seem to get the SQRT function to work.

The formula I am trying to create in DAX is this:

1.96*sqrt( ( p*(1-p)/n ) * ( (N-n)/(N-1) ) )

p= 0.896

I have created measures for N and n

My data looks like this and I have split the calculation into steps so I can monitor progress:

I cannot get the final step to work

MOE = SQRT(FullDataset[MOE a])

Can someone help.

I do know that the I have the result of infinity for 3 records for MOE a where n = 0. But the SQRT of infinity is infinity I didnt think it would matter.

Course Code | N | n | MOE P ( ( p*(1-p)/n ) | FPC ( (N-n)/(N-1) ) ) | MOE a (MOE P)*(FPC) ( ( p*(1-p)/n ) * ( (N-n)/(N-1) ) ) |

MH1231 | 4151 | 941 | 0.0001 | 0.7735 | 0.00008 |

AC3583 | 610 | 478 | 0.0002 | 0.2167 | 0.00004 |

MH1131 | 1671 | 400 | 0.0002 | 0.7611 | 0.00018 |

MF1525 | 1555 | 400 | 0.0002 | 0.7432 | 0.00017 |

AC1511 | 2313 | 388 | 0.0002 | 0.8326 | 0.0002 |

AC1501 | 1740 | 379 | 0.0002 | 0.7826 | 0.00019 |

Any help as urgently as possible would be amazing.

Thanks so much,

K

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

v-chuncz-msft

Community Support Team

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-06-2018
01:59 AM

You just need to add IF Function or IFERROR Function.

Community Support Team _ Sam Zha

If this post**helps**, then please consider *Accept it as the solution* to help the other members find it more quickly.

If this post

3 REPLIES 3

Keelin

Regular Visitor

SQRT error

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-04-2018
05:28 PM

Dear all,

I need some help.

I am trying to calculate the margin of error for a set of surveys.

My formula is as follows:

1.96*sqrt( ( p*(1-p)/n ) * ( (N-n)/(N-1) ) )

I cannot get the SQRT function to work in dax so I have split my work up to a series of steps to aid analysis. My data now looks like this. my measures are in bold and I have included the calculation for each one.

I now cannot get the final step of the equation to work.

MOE = SQRT(FullDataset[MOE a]) but this does not work. I get an error. Can I get a square root of a measure? Or could it be due to a few infinity results in MOE a? There is also a NaN result. Woudl this make a difference?

It seemed like this was going to be so straightforward but I am very new to this and I just cannot figure this out.

Course Code | N | n |
( ( p*(1-p)/n ) |
( (N-n)/(N-1) ) ) |
( ( p*(1-p)/n ) * ( (N-n)/(N-1) ) ) |

MH1231 | 4151 | 941 | 0.0001 | 0.7735 | 0.00008 |

AC3583 | 610 | 478 | 0.0002 | 0.2167 | 0.00004 |

MH1131 | 1671 | 400 | 0.0002 | 0.7611 | 0.00018 |

MF1525 | 1555 | 400 | 0.0002 | 0.7432 | 0.00017 |

AC1511 | 2313 | 388 | 0.0002 | 0.8326 | 0.0002 |

AC1501 | 1740 | 379 | 0.0002 | 0.7826 | 0.00019 |

Any help would be appreciated

v-chuncz-msft

Community Support Team

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-06-2018
01:59 AM

You just need to add IF Function or IFERROR Function.

Community Support Team _ Sam Zha

If this post**helps**, then please consider *Accept it as the solution* to help the other members find it more quickly.

If this post

Keelin

Regular Visitor

Re: SQRT error

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-07-2018
11:19 AM

Thanks so much for responding. Iferror worked like a charm.