statistics
5 TopicsPiechart diagram based on statistics (percentage calculation)
Dear all, I’m a Data Analysis course student, trying to make a Piechart diagram to represent a sample’s educational background (60.000 people in the sample). There are 5 groups of educational institutions (column [edulvlb] of my table ‘education’: basic education (codes 000,113,129), school diploma holders (codes 212 || 213 || 221 || 222 || 223 || 229 || 311 || 312 || 313 || 321 || 322 || 323), college diploma holders (codes 412 || 413 || 421 || 422 || 423 || 510 || 520), university diploma holders (codes 610 || 620 || 710 || 720) and PhD degree holders (code 800). So I need to count the codes per category (for example, how many times 000,113, 129 appear in column [edulvlb]) and then divide it by total amount of unfiltered rows (about 60.000 rows) of my entire datascheet. Therefore the choice of || which means OR in data selection… So I have divided this process in 2 steps: 1. Basis = CALCULATE (COUNTROWS(education),FILTER ('education',education[edulvlb] = 000 || 113 ||129)) School = CALCULATE (COUNTROWS(education),FILTER ('education',education[edulvlb] = 212 || 213 || 221 || 222 || 223 || 229 || 311 || 312 || 313 || 321 || 322 || 323)) College = CALCULATE (COUNTROWS(education),FILTER ('education',education[edulvlb] = 412 || 413 || 421 || 422 || 423 || 510 || 520)) Uni = CALCULATE (COUNTROWS(education),FILTER ('education',education[edulvlb] = 610 || 620 || 710 || 720)) PhD = CALCULATE (COUNTROWS(education),FILTER ('education',education[edulvlb] = 800)) 2. PercentageBasis = DIVIDE([Basis], Calculate([Basis], ALL('education'))) PercentageSchool = DIVIDE([School], Calculate([School], ALL('education'))) PercentageCollege = DIVIDE([College], Calculate([College], ALL('education'))) PercentageUni = DIVIDE([Uni], Calculate([Uni], ALL('education'))) PercentagePhD = DIVIDE([PhD], Calculate([PhD], ALL('education')) However, the piechart shows 5 segments of totally similar size 20%.. what have I done wrong here..maybe you could advise ?? Looking forward to hearing from you, thank you again for your help !! Best regards, Katia1.6KViews0likes7CommentsFind 95% Confidence Interval for Difference of Means
Client has asked for a graph of two columns' distributions to change color if the difference in means is ever statistically significant (or by my understanding, the 95% confidence interval doesn't contain 0). The changing color part is fairly idiomatic to Power BI. The 95% CI for Difference of Means? Not so much. I've got more math background than stats background. If nothing else, I can make one big fat DAX function using the mathematical formula for difference of means Confidence Interval, which is a doozie. That feels like it's pretty computation-heavy, requiring two averages, two standard deviations, a T.INV, and a square root to be done just as the precursors to a final calculation. I'm wondering if there's a more efficient DAX approach to this than just brute-forcing the equation. I looked into CONFIDENCE.T and CONFIDENCE.NORM, which are single-mean tests, and my gut tells me there might be a way to manipulate one of those into working, but I don't have the stats background to know what it would be.Solved2.4KViews0likes3CommentsStandard Deviation from 4 measured columns.... DARN!
Hi all! I've researched so many sites (and previous answers) concerning computing standard deviation in PowerBI. I never knew it would be so difficult for me to do since Excel makes it SIMPLE! I have a matrix table that I want to resemble an excel table. The data shown are all aggregate values compiled from individual records (with some duplicates). All columns are measures. It is important for the pivot to remain and that I only calculate the current month for each year. For an example, I want to calculate March for the current year and March for the previous 5 years (2022 - 2017). While the STDEVX.P function is fairly simple, I need it to only reference my previous 5 year columns (2017-2021). When I use the function, it references EVERYTHING since I don't have a DAX formula to add in the caveats. If my vision is possible, please help me out or let me know of alternatives. I will give kudos and I don't mind reading recommendations!Solved2.6KViews1like5CommentsLINEAR REGRESSION - X-AXIS IN TEXT FORMAT
Hello I am working with a data sample that contains numeric values on "y" axis (pH results) and text values on "x" axis (sample/batch code) and need to build a linear regression analysis. So far, I found a website "IterationInsights" that published an article "How to do simple linear regression in Power BI", which really helped me to analyse using date, but not sample code (since it is a text). I need to evaluate the trend between 2 samples, independent of when they were collected. Note that if x is a Date, we have: y = 0.0023x - 99.065, r² = 0.2566 But if x is the sample, we have: y = 0.0297x + 5.5252, r² = 0.3024 How am I able to build a variable table that converts the sample code to a numeric sequence (A1AA/22 = 1, A2AA/22 = 2, ...., A21AA/22 = 21)? Besides, it's possible to filter this table? Ex: analyse A12AA/22 to A20AA/22 (interval which would automatically be converted to the numbers: A12AA/22 = 1, A13AA/22 = 2, ...., A20AA/22 = 9, always starting with 1). Since slope formula is: [n(Σxy) - (Σx)(Σy)] / [n(Σx²) - (Σx)²], x should be refeered as a sequence of natural numbers representing the samples. n is the distinct count of the samples. I suppose that I should build a data var table to convert sample code to a number, and use All selected function to filter the samples I'm working with, but I'm really having a hard time to combine these functions and obtain a functional linear regression equation. I exemplified the solpe formula because I think the same solution would be applied to intercep, r², etc. For slope, I used the formula: --------------------------------------------------- SLOPE = var data = SELECTCOLUMNS(ALLSELECTED(DATA), "x_values",DATA[DATE], "y_values",DATA[RESULTS] ) --Variables to Solve for: var y_sum = SUMX(data,[y_values]) var x_sum = SUMX(data,[x_values]) var x2 = SUMX(data,[x_values]^2) var xy = SUMX(data,[x_values]*[y_values]) var row_count = COUNTROWS(data) --Solve for formula var Slope = ((row_count * xy) - (x_sum * y_sum))/((row_count*x2)-((x_sum)^2)) return Slope ----------------------------------------------------- Anyone could help me?1.4KViews0likes2CommentsAdjusting rolling Z-Score for new items
Good Morning Community, so I have a report that calculates rolling Z-Scores month to month, in order to do that, I have other rolling measures, thanks to this community, I found most of my answers/coding. For example, we trend codes and calculate the Z-Score over the previous 24 months of code usage. This is great for codes that have been used for a while, works perfectly. However, the one problem I'm running into now is when something new is added, it throws the Z-Score way above our "breach" line. Last month we introduced 4 new codes, so because of that, I have a DAX table that will automatically add missing values to whatever months are missing (this is a necessity, explained below), so for the 4 new codes, the last 23 months are all 0's. My measures are working the way they were intended but now my Z-Score is way off. So long story short is there a way in DAX to have measures exclude if X number rows = 0 and then return 0 for the Z-score. Kind of like an IF statement until we get above a threshold to start including the actual calculation? z = (x – μ) / σ z = standard score x = Current Month Value μ = Population Mean Value (previous 24 months) σ = standard deviation Here's an example of the new code being used. Code Amt Month Avg 24 m Std Dev 24m Z-Score BC07 8 08/01/2022 0.33 1.60 4.80 BC07 0 07/01/2022 BC07 0 06/01/2022 BC07 0 05/01/2022 BC07 0 04/01/2022 BC07 0 03/01/2022 BC07 0 02/01/2022 BC07 0 01/01/2022 BC07 0 12/01/2021 BC07 0 11/01/2021 BC07 0 10/01/2021 BC07 0 09/01/2021 BC07 0 08/01/2021 BC07 0 07/01/2021 BC07 0 06/01/2021 BC07 0 05/01/2021 BC07 0 04/01/2021 BC07 0 03/01/2021 BC07 0 02/01/2021 BC07 0 01/01/2021 BC07 0 12/01/2020 BC07 0 11/01/2020 BC07 0 10/01/2020 BC07 0 09/01/2020 BC07 0 08/01/2020 BC07 0 07/01/2020 BC07 0 06/01/2020 BC07 0 05/01/2020 BC07 0 04/01/2020 BC07 0 03/01/2020 BC07 0 02/01/2020 BC07 0 01/01/2020 BC07 0 12/01/2019 BC07 0 11/01/2019 BC07 0 10/01/2019 BC07 0 09/01/2019 BC07 0 08/01/2019 Here's an example of a working code, also shows why I had to insert 0 when a code wasn't used to get the correct Z-Score for the previous 24 months. This particular code wasn't used for 4 months in a row BUT I needed to show that to get an accurate Avg/Std Deviation and Z-Score. Code Amt Month Avg 24 m Std Dev 24m Z-Score Prev Month KP01 1 08/01/2022 2.08 6.36 -0.17 1 KP01 2 07/01/2022 KP01 2 06/01/2022 KP01 2 05/01/2022 KP01 5 04/01/2022 KP01 0 03/01/2022 KP01 0 02/01/2022 KP01 0 01/01/2022 KP01 0 12/01/2021 KP01 1 11/01/2021 KP01 0 10/01/2021 KP01 0 09/01/2021 KP01 0 08/01/2021 KP01 0 07/01/2021 KP01 1 06/01/2021 KP01 3 05/01/2021 KP01 1 04/01/2021 KP01 0 03/01/2021 KP01 0 02/01/2021 KP01 0 01/01/2021 KP01 0 12/01/2020 KP01 0 11/01/2020 KP01 0 10/01/2020 KP01 32 09/01/2020 KP01 26 08/01/2020 KP01 2 07/01/2020 KP01 2 06/01/2020 KP01 0 05/01/2020 KP01 2 04/01/2020 KP01 1 03/01/2020 KP01 0 02/01/2020 KP01 1 01/01/2020 KP01 3 12/01/2019 KP01 0 11/01/2019 KP01 0 10/01/2019 KP01 0 09/01/2019 KP01 0 08/01/2019Solved1.8KViews0likes2Comments