sumif
13 Topicssummarize rows based on a row specific measure like rankx
This is what I need: The sales amount % of items in the top 20 against the total sales. This must be dynamic, the top20 this week is different from the top20 last week. So I create a measure: [sales rank] = RANKX(ALLSELECTED('DIM-Item'),[Sales amt.]) this gets all items ranked based on the applied filters like week or item category. Now I want to calculate the sales amount of the items with rank < 21 SUMX( FILTER('DIM-Item', [sales rank] < 21), [Sales amt.]) So far so good. Only items in the top20 (rank < 21) get a value in the table. The problem is the total line. The total line show the full sales amount. This is because the [sales rank] in the total line = 1. It does not filter the item lines and then summarizes. It calculates the formula on the total line and then the filter for [sales rank] < 21 is not correct. Please check this table, especially the total line: Thanks for the help Kind regards, JohanSolved887Views0likes4CommentsDAX equivalent for sumif
Hi In Excel I'd use a sumif function to add 2 columns and if they added to 2 to return a 1 otherwise a 0. I've tried every which way to do this using DAX but it's always the wrong answer compared to excel - how do i do? example In excel to create the column called call 1 and call 2 i'd use this formula: =IF(SUM(FL2:FM2)=2,1,0), how can i replicate this in DAX call 1 call 2 call 1 and call 2 1 1 1 1 1 1 1 0 0 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 1Solved1.2KViews0likes6CommentsHelp me build a SUMIF funtion in powerBI
I would need to replicate, in a new column, a very simple SUMIF function. I've tried for hours, but i'm unable to complete this task in PowerBI. My database (DB_CORP) has, for each observation a single client name and 3 columns: "CUSTOMER" (the customer name); "GROUP" (the holding name of the customer, multiple customers can have the same GROUP name); "REVENUE" Below a screenshot of the new column formula I need to replicate. If a Group's revenues are negative, put a "Y" for each customer part of that group, and viceversa. veSolved1KViews0likes4CommentsDatesbetween
Hi guys, I'm néw to writing Dax queries and I'm currently stuck trying to use the "Datesbetween" feature to write queries with multiple criteria. I'm trying to have a stacked trend lines with multiple years. I want the lines to be overlapping in a combined trend form. The query bellow is not working. I'll appreciate inputs at this point. E.g TrendYears = CALCULATE(SUM(merged_data[Workinghours]), Datesbetween (merged_data[Date], date(2019,1,1), date(2019,12,31)), Datesbetween (merged_data[Date], date(2020,1,1), date(2020,12,31)), Datesbetween (merged_data[Date], date(2021,1,1), date(2021,12,31)), Datesbetween (merged_data[Date], date(2022,1,1), date(2022, 5, 25)))Solved2.3KViews0likes7CommentsCard Visual showing Count of X filtered by average Y per X over a time period
Trying to Create 2 card visuals (one for this year and one for last year) that show the number of stores that are selling above an average N amount per month. I think the best way to do this is to create a calculated column to sums the sales numbers by Store Name and Year. Can you let me know the best way to approach that? Or if that is not the right appraoch, what might be? Pretty sure I am overcomplicated a potentially simple goal.Solved1.6KViews0likes5CommentsSum values if another column is not blank
Hello, I'm relatively new to dax and i'm trying something more complicated but i fail 😞 I have the following data: Product Available Sold 1 Product_1 10 9 2 Product_1 66 0 3 Product_1 45 38 4 Product_2 48 0 5 Product_2 41 0 6 Product_3 54 29 7 Product_3 45 27 8 Product_3 17 0 9 Product_3 15 9 What i would like to do is: Check if there any value in column sold greater than zero. If yes then sum all 'available' by product. Product Available (sum) Product_1 121 (10+66+45) Product_2 0 or null Product_3 131 (29 + 27 +10 +9) I tried the following sumif = var __table = FILTER('data$', [Sold] <> 0 ) return sumx(__table,[Available]) but i only get the sum of the rows that are non zero (rows: 1, 3, 6, 7 and 9) What i'm missing? Thank you! GrigorisSolved4.4KViews0likes2CommentsSum of maximal value for specific name
Moving from (pivot)tables in Excel to Power BI provides some struggles. I will try to show my struggle as detailed as needed. The case: as a KPI (Key Performance Indicator) in sports I need to know from longitudinal data IF a player passed the benchmark or not (providing a % by dividing passed/all cases). He only needs to pass the benchmark once during the year (multiple matches obviously; benchmark can be different depending on playing position). Name Match Total distance covered (m) Benchmark (m) Passed (o=no;1=yes) Player A 1 6000 5000 1 Player B 1 4000 5000 0 Player C 1 7000 6000 1 Player D 0 ** 1500 - - Player A 2 5500 5000 1 Player B 2 4000 5000 0 Player C 2 5000 6000 0 ** not enough playtime, so data is there, but not included for the KPI. KPI = passed/total In Excel I would insert a Pivot table on the table above and then use "Max of passed" providing for each player if he ever passed the benchmark and total amount of filled cells (so unique players in this pivot table). The pivot table in this example would look like: Name Max of passed Player A 1 Player B 0 Player C 1 KPI: 2 out of 3=66.7% Player D is not included in pivot table, since there is no valid data (0 or 1) Sum of Max of passed is needed, since 'just' sum of passed will provide 2 instead of 1 for player 1. In Power BI I provided a new measure "amount_players" which is: DISTINCTCOUNT(query1[player]). This will show the amount of players that pass multiple filters (minimum of playing time, team and season). Now I need a measure "amount_passed" but using MAX(X), SUM or a combination does not deliver the right answer. The main struggle appears when a player is able to pass the benchmark for 3 matches; any use of sum wants to enter the player with a '3', but I only want to count him once. If I need to provide more context or sample data, please let me know!Solved949Views0likes3CommentsCalculate Sum of weekly value only if previous week was negative
I am trying to do a running sum af resource availability. But if a resource is over-used the previous week, I would like to subtract it from the current week. If it is under-used I do not want it to carry forward. For instance: Capacity 14 14 14 14 14 Orders 12 16 13 12 10 Available 2 -2 -1 1 41.2KViews0likes3CommentsHow to sum cells which are also present in mapping table?
Hi all, How do I create a measure that does the following: Sum table 1[column A] for all rows where table 1[column B] is equal to a value in table 2[column C] Right now I am writing it as: Measure 2 = Calculate(SUM(Table1[ColumnA]), Table1[ColumnB]=Table2[ColumnC]) But PowerBI is returning an error "The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression." In Excel, I would write this as: SUMIF(ColumnB, Table2'ColumnC', ColumnA) Please help. Thanks!1.2KViews0likes2CommentsSUMIF in DAX with filter - new measure
Hello! I'm creating a measure called Adj New Biz and I would like it to function as such: SUMIF (Project_Group_ID = NBIZ) OR ((Project_Group_ID = INT) AND CategoryName = "Marketing/New Business" or "Business Development" So you see I'm just making sure all of INT's hours that were related to new business and business development are added into everything that is under project group ID NBIZ. Not sure of an easier way to do this. I do not want to make a table, but would rather have a measure. Still pretty new to DAX. Any advice? Am I asking for two much from a measure? Should I try and code a table instead?Solved720Views0likes1Comment