User Profile
jk8979356
Regular Visitor
Joined 5 years ago
User Widgets
Contributions
How to sum multiple rows from another table
I have a table that has [Subsidiary] [Category] [2019 Sales] [2020 Sales] columns with thousands of rows and I need to either sum the 2019 & 2029 sales rows in this table or in a new reference table so that the output is [Subsidiary] [Category][2019 Sales][2020 Sales] {Sub1}{Cat1}{19 sales total}{20 sales total} {Sub1}{Cat2}{19 sales total}{20 sales total} {Sub2}{Cat1}{19 sales total}{20 sales total} {Sub2}{Cat2}{19 sales total}{20 sales total} Where each row sales total is the total for only that specific subsidiary>category combo. What is the cost to do this?1.3KViews0likes2CommentsWhat is the code for a multiple condition, nested IF statement?
I need to create a multiple condition nested multiple IF statement to identify matches and then add text in a new conditional column. Their are two columns: [Column.Family] [Column.Item] and the logic is: IF [Column.Family] equals "Blue" or "Black" or "White" or "Red" AND IF [Column.Item] starts with "Mens Jeans" then return "Mens" in the new conditional column, else return [Column.Item] IF [Column.Family] equals "Blue" or "Black" or "White" or "Red" AND IF [Column.Item] starts with "Womens Shirts" then return "Womens" in the new conditional column, else return [Column.Item] IF [Column.Family] equals "Blue" or "Black" or "White" or "Red" AND IF [Column.Item] starts with "Youth Boys Shoes" then return "Youth Boys" in the new conditional column, else return [Column.Item] IF [Column.Family] equals "Small" or "Medium" or "Large" or "XL" AND IF [Column.Item] starts with "Football Uniforms" then return "Football" in the new conditional column, else return [Column.Item] How can I create the multiple conditions and multiple nested if statements in M?Solved3.7KViews0likes2CommentsHow should I design relationships between 3 tables?
Forgive me as I don't fully understand the proper way to design table relationships. I have three tables of transaction data: 2019 Actual Sales, 2020 Sales Forecast, 2021 Sales Forecast. Each table has the same 31 data columns, except the 2020 Sales Forecast table which has an additional 2 calculated columns. These are tables full of transactional data with no unique identifier keys. I am trying to use Power Query / Power Pivot to combine these 3 tables into a single pivot with multiple data rows that each use the Quantity & Revenue columns for the pivot table "Values". How do I create the relationships so I can compare Values from the 3 tables for the common columns shown here. Keeping in mind each table has thousands of different entries for each data row type.Solved1.7KViews0likes1CommentHow do I nest an IF statement rather than create a new column for it?
I am using Power Query to take year to date sales data and compare it to our estimated total sales for the entire year. With this YTD vs full year comparison I am creating a "Forecast Factor" number that I then use to estimate the total item level sales for the full year. For example: Year to date Sales: $900 Estimated total sales for year: $1000 Forecast factor: 900 / 1000 = 90% Widget ABC YTD Sales: $10 Forecasted Widget ABC sales for full year: 10 / .90 = $11.11 Now where this formula breaks down is if my year to date sales exceeds my estimated total sales for year: Year to date Sales: $1100 Estimated total sales for year: $1000 Forecast factor: 1100 / 1000 = 110% Widget ABC YTD Sales: $10 Forecasted Widget ABC sales for full year: 10 / 1.1 = $9.09 So to account for this, I created an if statement that says if YTD sales are <= estimated total sales, then use (YTD sales / total estimated sales) to create a "Forecast Factor" that the Widget sales is then divided by (example 1 above). Else, return a value of 1 for the Forecast Factor. = Table.AddColumn(#"Added Sales Forecast Column", "Forecast Factor", each if List.Sum(#"Changed Type2"[Amount]) <= #"2020forecast"{0}[Column2] then (List.Sum(#"Changed Type2"[Amount]) / #"2020forecast"{0}[Column2]) else 1) I am currently putting this "Forecast Factor" in as a new column. My question is there anyway to skip adding the forecast factor as a new column and instead nest the IF statement directly into my Widget ABC forecasted sales column? Currently my Widget forecast code is. How would I change this code, to nest the Forecast Factor IF statement directly into it? = Table.AddColumn(#"Added Qty Forecast Column", "Sales Forecast", each if [Amount] <= 0 then [Amount] else [Amount] / [Forecast Factor])628Views0likes2CommentsRe: How do I reference a specific cell value from a 2nd table inside of a formula on a different table?
I have read that discussion, but don't understand the exact M code I need in my situation. I'm fine if I need to first bring in the value from the forecast table into the sales table, but what exact M code do I use to do this? Since there is only a single value in the forecast table and I am not using a match of any kind, but rather using 1 single value for all rows, what code do I use to add the forecast value into my sales table as a new column?16KViews0likes0CommentsHow do I reference a specific cell value from a 2nd table inside of a formula on a different table?
I have a table that has the following formula: = Table.AddColumn(#"Changed Type2", "Qty Forecast", each if [Quantity] <= 0 then [Quantity] else ([Quantity] / (List.Sum(#"Changed Type2"[Amount]) / 19950000))) This formula works, but rather than have a hard coded value of 1995000, I want to use a variable value that is pulled from another table in the Power Query Editor. The 2nd table is named "forecast" and has the value in row 1 of column2. What is the exact M script code to replace the hardcoded 19950000 value with a script that pulls the value from the "forecast" table, row 1, column2? Both tables are in the same Power Query Editor but are not merged queries.Solved16KViews0likes8Comments
Data Privacy
Microsoft Fabric Community and Privacy
To learn more about how we manage your data, please review the Microsoft Fabric Community Data Privacy guide.