This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (l as list, selections as list)=> | |
| let | |
| Source = | |
| List.Accumulate( | |
| selections, | |
| {}, | |
| (state,current)=> | |
| if | |
| Text.Contains(current,":") | |
| then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (l as list, range as list)=> | |
| let | |
| Start_Position = List.PositionOf(l, range{0}), | |
| End_Position = List.PositionOf(l, range{1}), | |
| Result= List.Range(l,Start_Position,(End_Position-Start_Position)+1) | |
| in | |
| Result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //SPEC | |
| { | |
| "data": { | |
| "name": "dataset" | |
| }, | |
| "title": "Sales Variance by Product", | |
| "transform": [ | |
| { | |
| "calculate": "17000000", | |
| "as": "target" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //SPEC | |
| { | |
| "data": { | |
| "name": "dataset" | |
| }, | |
| "title": "Sales Variance by Product", | |
| "transform": [ | |
| { | |
| //"calculate": "datum['Total Sales'] *.80","as": "target" | |
| "calculate": "17000000", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //SPEC | |
| { | |
| "data": { | |
| "name": "dataset" | |
| }, | |
| "title": "Sales Variance by Product", | |
| "transform": [ | |
| { | |
| //"calculate": "datum['Total Sales'] *.80","as": "target" | |
| "calculate": "17000000", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "data": { | |
| "name": "dataset" | |
| }, | |
| "title":"Total Sales by Segment - Vertical Bar Chart", | |
| "encoding": { | |
| "x": { | |
| "field": "Segment", | |
| "type": "nominal", | |
| "sort":"-y", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPECS | |
| { | |
| "data": { | |
| "name": "dataset" | |
| }, | |
| "title":"Sales Variance by Product", | |
| "transform": [ | |
| { | |
| //"calculate": "datum['Total Sales'] *.80","as": "target" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (t as table, seed as number) => | |
| let | |
| // Step 1: Add an index column to the input table to preserve row order and enable alignment | |
| Source = Table.AddIndexColumn(t, "__Index", 0, 1, Int64.Type), | |
| // Step 2: Generate a reproducible list of random numbers using the provided seed | |
| // This ensures consistent output across refreshes or deployments | |
| Random_List = List.Random(Table.RowCount(t), seed), | |
| // Step 3: Convert the random list into a table and add an index column for joining |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (df as table, independent as text, dependent as text)=> | |
| let | |
| Source = | |
| R.Execute( | |
| "df <- dataset " & | |
| "#(lf)logit <- glm(" & dependent & " ~ " & independent & ", data = df, family = ""binomial"")" & | |
| "#(lf)df$Predicted <- predict(logit, newdata = df, type = ""response"")" & | |
| "#(lf)df$Prediction <- ifelse(df$Predicted > 0.5, 1, 0)" & | |
| "#(lf)df", [dataset=df]), | |
| Return = Source{[Name="df"]}[Value] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (df as table, independent as text, dependent as text, family as text)=> | |
| let | |
| Source = | |
| R.Execute( | |
| "df <- dataset" & | |
| "#(lf)logit <- glm(" & dependent & " ~ " & independent & ", data = df, family = """ & family &""") " & | |
| "#(lf)summary_model <- summary(logit) " & | |
| "#(lf)coef_df <- as.data.frame(summary_model$coefficients) " & | |
| "#(lf)coef_df$Variable <- rownames(coef_df) " & | |
| "#(lf)coef_df <- coef_df[, c(""Variable"", ""Estimate"", ""Std. Error"", ""z value"", ""Pr(>|z|)"")] " & |
NewerOlder