dax averages
15 TopicsDAX averages in a matrix
Hello, I have been working on a Power BI report that calculates weighted averages across business locations and location groups in a matrix. The location group and location columns are placed in the row section. While the measure I’m currently using accurately calculates the location averages, the location group averages are incorrect. The following measure returns the correct location averages: DAX Setup Days = CALCULATE( AVERAGE('CGM'[DeliveryDays]), KEEPFILTERS('CGM'[Deliverydate] >= DATE(2025, 3, 1)), KEEPFILTERS('CGM'[Deliverydate] <= DATE(2026, 2, 28)) ) The averages and number of deliveries for each location are as follows: - Location 1: Average = 36, Deliveries = 1 - Location 2: Average = 17.03, Deliveries = 34 - Location 3: Average = 16.50, Deliveries = 14 - Location 4: Average = 17.86, Deliveries = 29 The correct average for the location group is 17.49, which I verified in an Excel file. There was also an additional location with a zero average included in the Excel. However, my measure returned an average of 16.95 for the location group. I would appreciate any help you can provide to resolve this issue.Solved1.2KViews0likes5CommentsDesperately need help! Avg tickets for each hour for selected days of week in a selected date range
I have been trying every possible option for days now and I am just going around in circles. I have a Date table, a Time table, and a data table. My data table contains one ticket per row with a timestamp. I have broken out the time stamp into date, time, weekday and hour. I have a day of week slicer that is connected to my date table ('Date'[Day of Week]) and a date slicer that is connected to my date table ('Date[MMYY]). These are the measures that I am using: Total Tickets = Countrows('Mytable') Avg Per Day = AVERAGEX(DISTINCT('MyTable'[Date Created]),Calculate(Countrows('MyTable')/[Count Days])) Count Days = DISTINCTCOUNT('MyTable'[Date Created]) Hourly Average = AVERAGEX(SUMMARIZE('MyTable', 'MyTable'[Hour],"Hourly Total",COUNTROWS('MyTable')),[Hourly Total]) The Hourly Average is where I am struggling. The hourly average measure is actually giving me the totals per hour for the selected day where I need the hourly AVERAGE of tickets per hour of each day (for the slicer selected day(s) and Month(s). I tried Hourly Average = AVERAGEX(SUMMARIZE('MyTable', 'MyTable'[Hour],"Hourly Total",COUNTROWS('MyTable')),[Hourly Total])/[Count of Days] and that gives incorrect averages that do not add up. As a test, I tried manually adding in the count of days. and this works. The averages per hour across the days is correct. So All Saturday and Sundays in Jan, Feb, and March = 25. Hourly Average = AVERAGEX(SUMMARIZE('MyTable', 'MyTable'[Hour],"Hourly Total",COUNTROWS('MyTable')),[Hourly Total])/25. Here's what I get in excel and what I am expecting to see - How do I get this measure to work using the slicer selected days?Solved1.3KViews0likes3CommentsCalculating Average of a measure within a hierarchy
Hi everyone, I need to solve an issue that I am having with DAX, but I cant find the right query. To give you some context: I have different regions in my data that have the values T100, T200, T300 and so on. They can be found in the column RegionLevel2 in the table Geography. Then , in the same table there is a column called TerrLevel1 that has the territories. Each region has multiple territories. So for example the territories for region T100, are T101, T102, T103 and so on. For each of these territories I have calculated a Score, based on their individual sales. It is a measure called Score1 and working fine. Now I need to calculate the score for the regions. This score is based on the average of the sales of a regions territories. So in the case of T100, its score would be the average of the Score1 of T101, T102, T103 and so on. I have tried these DAX AVERAGEX(Geography, [Score1]) AVERAGEX(all(Geography[TerrLevel1]), [Score1]) AVERAGEX(VALUES(Geography[TerrLevel1]), [Score1]) CALCULATE( AVERAGEX(Geography, [Score1]), ALL(Geography[TerrLevel1])) but it is not giving me the right result. I guess i need to filter somehow to group the right territories with their region but I cant figure out how. I would appreciate any kind of help. Thank!748Views0likes3CommentsFill Blank Values and Get an Average in Total
Please find the table below School Jan 2023 Feb 2023 Mar 2023 Apr 2023 May 2023 Jun 2023 July 2023 Aug 2023 Sep 2023 Oct 2023 Nov 2023 Dec 2023 Total ABC 10 I want to fill the blank with X value and then when they are added I need an average in the total. However, it only shows 10 in the total but not average when I use the below DAX IF(AVERAGE(X_VAL) = BLANK(),100,AVERAGE(X_VAL)) Please can we fill them with the value and all the values should be used for the computation to get an average in the total column which is auto generated from power BISolved2.3KViews0likes4CommentsSum the averages of multiple categories
Hello! I'm struggling to come up with a DAX formula (measure or calculated column) that will calculate the Sum of the average score for each evaluation area. In my scenario, there are 3 people giving scores to 2 different companies based on 3 different evaluation areas (e.g., John scores Company X and Company Y based on criteria 1, 2 and 3). I want to calculate the average score of each evaluation area by company, and then sum those averages (so the sum of averages for each company). I'm hoping to make the formula dynamic so that if certain scorers or eval areas are filtered out, the end result would change accordingly. Thank you very much! The end result will look like the last column in the table below. The calculations should look like this: Company X: Avg score of eval area 1 = 2.83 Avg score of Eval area 2 = 2.50 Avg score of Eval area 3 = 3.50 Sum of all eval areas = 8.83 Company Y: Avg score of eval area 1 = 3.33 Avg score of Eval area 2 = 2.67 Avg score of Eval area 3 = 3.0 Sum of all eval areas = 9.0 Evaluation Area Scorer Score Company Calculated column/measure desired result Eval area 1 Andy 3 Company X 8.83 Eval area 1 John 4 Company X 8.83 Eval area 1 Beth 1 Company X 8.83 Eval area 2 Andy 2 Company X 8.83 Eval area 2 John 3 Company X 8.83 Eval area 2 Beth 1 Company X 8.83 Eval area 3 Andy 5 Company X 8.83 Eval area 3 John 1 Company X 8.83 Eval area 3 Beth 2 Company X 8.83 Eval area 1 Andy 5 Company Y 9.0 Eval area 1 John 1 Company Y 9.0 Eval area 1 Beth 3 Company Y 9.0 Eval area 2 Andy 2 Company Y 9.0 Eval area 2 John 4 Company Y 9.0 Eval area 2 Beth 5 Company Y 9.0 Eval area 3 Andy 3 Company Y 9.0 Eval area 3 John 2 Company Y 9.0 Eval area 3 Beth 1 Company Y 9.0Solved1.2KViews0likes2CommentsHow to calculate the average of values in a calculated column?
Hello all, I am new to DAX and I am totally stuck in calculating an dynamic average value for a calculated column. The calculated column for my table: Distinct Companies per Headline = CALCULATE(DISTINCTCOUNT('Main Data'[Company]), ALLEXCEPT('Main Data', 'Main Data'[HeadlineID])) The table with the column: HeadlineID Company Distinct companies per headline 2113 A 2 2113 B 2 2114 C 1 2115 D 1 Now I would like to calculate the average of distinct companies per headline. The expected result would be: Average = (2+1+1)/3 because HeadlineID 2113 is 2 times in the list. I tried to use summazie to create a new table so that only distinct headlineID and distinct companies per headline will be included. But it doesn't work. Can you help me in this? Thank you a lot! Average_Distinct_Companies_per_Headline = VAR SummaryTable = SUMMARIZE( 'Data', 'Data'[HeadlineID], "Distinct_Companies_per_Headline", CALCULATE(DISTINCTCOUNT('Main Data'[Company]), ALLEXCEPT('Main Data', 'Main Data'[HeadlineID])) ) RETURN AVERAGEX(SummaryTable, [Distinct_Companies_per_Headline])Solved913Views0likes4Commentscalculate max and min of a measure
hi everyone I have created a measure that calculated the achievement % . I'm trying to create max, min measure for that column for each sales agent and then find the average achievment% for all categories for the agent. reference to the example below: from the measure [new achiev%], i want to create maximum achievement measure and return 92% and minimum achievement measure return 61% to return and then the average achievement measure to return 73.19% what i'm trying to calculate from these measures is the sales agent incentive. the rules for the measure calculation is: -at least one category has achievment % of 90% -the achievement in all other 3 categories should be at least 70% in the example provided, agent won't get his incentive because he achieved 92% in one category and achieved below 70% in other categories.920Views0likes4CommentsCalculating average of summed values
Hi everyone, I have a table regarding the sales of our sales reps. that has the following structure: Sales Rep Year Month Sales Value A 2020 5 5 € B 2020 6 10 € B 2021 6 11 € … … … … I would like to create an average growth of each sales rep so I can say something like "Sales rep E's sales grew by 8% while on average the sales of sales reps A-D grew by 4%". My initial idea was to use the SUMMARIZE command to create a table like this: Sales Rep Sales Value CY Sales Value PY Growth A 465 € 320 € 45% B 650 € 544 € 19% … … … … ...from which I was hoping to use the AVERAGE command to calculate the desired value. However, I am uncertain how to actually build a table like this with SUMMARIZE. Can anyone please help? Or do I even overcomplicate the issue and a simpler DAX approach is possible here? -------- Here is my current DAX attempt (where I am having difficulties including the growth column): TEST = ADDCOLUMNS( SUMMARIZE( Table, Table[Sales Rep] ), "CY", CALCULATE( sum(Table[Sales Value]), FILTER( 'Date', year('Date'[Date]) = 2022 ) ), "PY", CALCULATE( sum(Table[Sales Value]), FILTER( 'Date', year('Date'[Date]) = 2021 ) ) )Solved958Views0likes2CommentsCompare columns based on two different table
Hi, How to compare columns in two different table ,I have tried with full outer join but not working as expected. Please check sample data provided below input of two tables and output expected. Example: table1: member deal qty date T90 A20 10.5 10/18/2020 T90 A21 68.55 10/3/2020 T90 A21 68.26 10/3/2020 T90 A22 17.41 10/9/2020 table2: Member Deal Qty Date T90 A21 68.55 2020-10-03 T90 A21 68.26 2020-10-03 T90 A22 17.41 2020-10-09 Expected output: tbl1.deal tbl2.Deal Matching Deal tbl1.member tbl2.Member Matching Member tbl1.date tbl2.Date Matching Date tbl1.qty tbl2.Qty Matching Qty A20 No T90 No 10/18/2020 No 10.5 No A21 A21 Yes T90 T90 Yes 10/3/2020 10/3/2020 Yes 68.55 68.55 Yes A21 A21 Yes T90 T90 Yes 10/3/2020 10/3/2020 Yes 68.26 68.26 Yes A22 A22 Yes T90 T90 Yes 10/9/2020 10/9/2020 Yes 17.41 17.41 Yes Thanks, SBCSolved6.6KViews0likes3Comments