groupby
32 TopicsSUMX Group By Multiple Categories
I have this table, which shows the correct results in Total By ID and Month. UniqueID0 DateClosed TotalHoursClosed Total By ID and Month 1 9/30/2024 8 8 1 10/9/2024 8 12 1 10/10/2024 4 12 2 10/9/2024 8 16 2 10/9/2024 8 16 3 9/30/2024 4 4 3 10/9/2024 4 4 If I use this I get the equivilant of Total Hours Closed Column. TotalHoursByIDandMonth = Calculate(SUMX(VALUES('BCP (2)'[UniqueID0]),[TotalHoursClosed]),GROUPBY('BCP (2)','BCP (2)'[UniqueID0],'BCP (2)'[DateConversion])) Even though it's not making sense because I've read that ALLEXCEPT just removes filters, and I don't have any filters, but it's closer to what I need-it sums by UniqueID0 but doesn't take into consideration the date, so the first 3 rows e.g. equals 20: TotalHoursByIDandMonth = Calculate(SUMX(VALUES('BCP (2)'[UniqueID0]),[TotalHoursClosed]),ALLEXCEPT('BCP (2)','BCP (2)'[UniqueID0],'BCP (2)'[DateConversion])) [DateConversion] is a Calculated Column DateConversion = EOMONTH('BCP (2)'[DateClosed],-1)+1 How would I sum this grouping by UniqueID0 and DateConversion(FirstOfMonth)?Solved2.3KViews0likes10CommentsDAX Calculated Column in the Table View
I want to create a calculated column in the Table View in Power BI. I want the calculated column to group the "Company" column based on how many unique values occur in the "Lender" column. For example, the below table has 3 companies, and each company has two records of their lenders. Company1 has two different lenders, so I want the calculated column to list "2" for both of its records. Company2 and Company3 have the same lender listed twice, so I want the calculated column to list "1" for both of its records. Company, Lender, Count of Lenders Company1, Private, 2 Company1, Public, 2 Company2, Private, 1 Company2, Private, 1 Company3, Public, 1 Company3, Public, 1 I know this is possible to achieve with Power Query, but can I achieve it in the Table View once the data is loaded out?Solved641Views0likes2CommentsCount and Aggregate by multiple values
Hello! So, I'm trying to resolve this, I believe the answer is righ there in front of me, but I just can't assemble my thoughts right... I have the table below and I need 2 measures: 1) Quantity of distinct projects by department and 2) For each Project and department, how many tasks is a owner responsible by? I tried to use "group by", but I did it in two steps: firts, I created a new calculated table, grouping by Project, Task, Department and Owner. Then, I created a measure using "group by" like this: COUNTROWS(GROUPBY("groupstep1","groupstep1[Owner]","groupstep1[Task]","groupstep1[Project]". It actually worked, but I was wondering if there is any way to do this without the firts step. Or any better way....Solved603Views0likes1CommentSUMX SUMMARIZE group by company in a table
Hi all. I have a simple table made of 2 fields and 1 measure: where _Sales Denominator YA ORG = CALCULATE( [_Sales YA ORG] , ALL(Company[Company], Company[Brand],Company[Sub Brand], Company[Variant]) , ALLSELECTED(Period[Period]) ,ALLSELECTED('Market Breakdown'[Country]) ,ALLSELECTED('Organic Claim'[Organic Claim]) , VALUES('W Segment'[W Segment]) , VALUES('Market Brkdown'[Hier Level Name]) , VALUES('Ad Hoc Analysis View'[Category]) , VALUES('Ad Hoc Analysis View'[Segment]) ) what I want to do is to delete the country field and obtain one row for each company with the sum of each _Sales denominator YA ORG for each company. For example I want this result: Company _Sales denominator YA ORG PRIVATE LABEL 3402952 STRAUSS GROUP 206 TCHIBO 36854 TONYS COFFEE ROASTERS 2895 VERGNANO 1131 WERTFORM 3987 WICKED JOE LLC 23592 WOSEBA 1035 So what I've tried is to modify the measure this way: _Sales denominator YA ORG= SUMX( SUMMARIZE( 'Ad Hoc Analysis View', 'Ad Hoc Analysis View'[Company], "x_per_company", CALCULATE( [_Sales YA ORG], ALL(Company[Company], Company[Brand],Company[Sub Brand], Company[Variant]), ALLSELECTED(Period[Period]), ALLSELECTED('Market Brkdown'[Country]), ALLSELECTED('Organic Claim'[Organic Claim]), VALUES('W Segment'[W Segment]), VALUES('Market Brkdown'[Hier Level Name]), VALUES('Ad Hoc Analysis View'[Category]), VALUES('Ad Hoc Analysis View'[Segment]) ) ), [x_per_company] ) But I obtain this table, with summarized values that are different from what I expect: Do you have any suggestion? Thanks508Views0likes1CommentDAX Summarizecolumns and then countrows per group
Hi, I have query with 3 dimensions (Continent/CountryRegion/City) part of paginated report. I would like to highlight only those child groups where there is 1 item. So I need to get a count of items per each parent group. In this case, let's write the query, to be more exact. EVALUATE VAR __t1 = SUMMARIZECOLUMNS ( Customer[Continent], Customer[CountryRegion], Customer[City], "Amount", [Sales Amount] ) RETURN GROUPBY( __t1, Customer[Continent], Customer[CountryRegion], "Count" , countX(CURRENTGROUP(), Customer[CountryRegion] ) ) ORDER BY Customer[Continent] DESC Which brings me this Result I am looking for is And in a case where I have 3 dimensions EVALUATE VAR __t1 = SUMMARIZECOLUMNS ( Customer[Continent], Customer[CountryRegion], Customer[City], "Amount", [Sales Amount] ) RETURN GROUPBY( __t1, Customer[Continent], Customer[CountryRegion], Customer[City], "Count" , countX(CURRENTGROUP(), Customer[City] ) ) ORDER BY Customer[Continent] DESC I get But I would like to see How should I approach this? Thank you!993Views0likes2CommentsMax for each subset of records
Hi How could I obtain the max value for each product group in the table? This is what I have imaged to have: New measure: Maxno = CALCULATE(MAX(pri[pri_no]);allselected(pri[ProductGroup])) This is a subset of the data: Product-Group Pri-No A 1 A 2 A 3 B 1 B 2 C 1 D 1 D 2 D 3 D 4 This is the final wanted result: A 3 B 2 C 1 D 4 Thanks for your comments. Best Regards,Solved6.5KViews0likes3CommentsIndex Column Groupby() and currentgroup()
Hi all, i have a table with the columns ID and Category. The goal is to create a new table that lists the IDs, and an index of the number of categorys an ID had in its lifetime. Example: Data Table ID / Category 00001 / SWF Info 00001 / Response FOMA 00001 / Creditreform 00001 / Legal IKU 00001 / Bankcrupcy Desiered Result should be: ID / Index 00001 / 5 I tried thisSolved1KViews0likes4CommentsCreate a new Table with only the last Case steps from a existing Table
Hi, i´ve been trying to create a new Table using the Summarize(), Addcolums() and Lastnonblank() function. I have a table called "Bearbeitung" which lists all cases with their single steps, this table is sorted in Querry by date (increasing). I want to create a new Table called "letzte Bearbeitung" which lists for every distinct case "Vorgangs_ID" the the last step based on the last time it was edited. I ran into an error. My code doesnt work right. The LASTNONBLANK() funktion wont give the last result for ID_Nonth_UserID and Status_after_Handling. Don't know why, what am i doing wrong here? Is there maybe a better solution using the GROUPBY() function?489Views0likes1CommentGet latest date for certain task ID
Hi, I have the data as shown below: Entity Id Covenant ID Covenant Sub Type TaskID Latest Comment Date 21632312 108 Net Interest Cover 38499 11/11/2020 21632312 108 Net Interest Cover 38499 02/11/2020 21632312 109 Leverage Ratio 38508 11/11/2020 21632312 109 Leverage Ratio 38508 02/11/2020 21632312 110 Capital Expenditure 38517 02/11/2020 21632312 110 Capital Expenditure 38517 11/11/2020 for each covenant ID and task ID I only want to show the last 'Latest Comment Date'. For instance if you look at Task ID 38499 I only want to see the 'Latest Comment Date' as 02/11/2020 What measure can I write for this? Kind Re1.2KViews0likes3CommentsDAX measure to calculate the sum of transactions for all users equal or above a threshold percentile
Hi, I have what I thought was a fairly easy DAX problem, unfortunately I am struggling with it. I have a user input for a parameter, which takes the input of a percentile. In my data, I have client_IDs associated to any and all of my transactions. I would like to get a measure that calculates the total number of all transactions for clients with a number of transactions at or above the threshold percentile specified by the user. For example, if a user inputs 75 in the what-if parameter, the measure should produce the total number of transactions for all clients equal to or above the 25th percentile as determined by their transactions count. One caveat is that, I need to handle scenarios where there are ties. I want to settle ties arbitrarily. So for example let's say to be in the top 80 percent of clients you need to have at least 2 transactions and to be in the top 70 percent the client needs at least 3 transactions then to get the top 75 we would have to randomly choose to add some of the clients with 2 transactions to our total and to exclude the others. The ones which are kept for the total vs the ones that are not, is not important. If it were in python it would look like this: number_of_clients = dataset.groupby('client_id').size().shape[0] top_count = dataset.groupby('client_id').size().sort_values(ascending = False).cumsum()[:math.ceil(what_if_parameter*number_of_clients)].sum()1.1KViews0likes2Comments