countrows
61 TopicsCOUNT/COUNTROWS return 0 instead of blank
Hello, I am currently have an issue with count/countrows. When they evaluate and return nothing it shows blank instead of 0. I have 2 tables, a calendar table and a fact table with 10 rows. I am trying to calculate the percentage of colum ORIT = "Y". Lines ORIT2 = var _orit = CALCULATE(COUNTROWS(dataVN),dataVN[ORIT]="Y") return if(ISBLANK(_orit),0,_orit) The result is this. I don't want those extra lines that mean nothing. The manufacturing data field comes from the calendar table. How can I avoid this situation and get the desired result? The .pbix file is in this link if you want to try - https://we.tl/t-bHGwtdUf5d Thank you. AndréSolved11KViews0likes6CommentsCount working days of running month [Friday is weekend only] & Days elapsed
Hi Experts, Please help me out! Struggling to create a measure which will return total working days of current month dynamically [please note, Friday is only weekend in my organization]. I would also want to exclude holidays. I have a calendar table [see scrrenshot], now I want to calculate two measures 1. Total working days of current month 2. Days Elapsed = First Date of current month - Today () -1 [Excluding weekends and holidays] Thans in advance MamunSolved7.8KViews0likes8CommentsDAX Calculate Countrows, average per Year per Weekday
Hello, I think I have a simple question but I can't figure out how to do it. I have a table in BI for example with a Date column and a column with the matching weekdays. There can be multiple equal dates because it's an order picking table. I would like to have that it counts the rows from the same Weekday and divide it by the matching dates. So when I have 6 rows in total on Mondays and these Mondays matches two dates, the calculation should be 6 / 2 Then my average = 3 (check table as example) What should be the correct DAX formula for this? Date Day of the week 2022-01-03 Monday 2022-01-03 Monday 2022-01-03 Monday 2022-01-03 Monday 2022-01-04 Tuesday 2022-01-04 Tuesday 2022-01-05 Wednesday 2022-01-05 Wednesday 2022-02-07 Monday 2022-02-07 Monday 2022-02-08 Tuesday 2022-02-09 Wednesday 2022-02-10 Thursday 2022-02-10 Thursday etc. etc. Average Countrows per Year per Weekday Result Calculation Monday 3 6 rows on Monday / 2 Dates Tuesday 1,5 3 rows on Tuesday / 2 Dates Wednesday 1,5 3 Rows on Wednesday / 2 Dates Thursday 2 2 Rows on Thursday / 1 Date With kind regards, Björn KoenenSolved4.4KViews0likes9CommentsSum visible rows in matrix visual
Hi, I have a matrix table, with multiple rows and values. I wanted to count number of products but the measure I wrote is not summing in the table nor in card visual. Rows are coming from 6 different tables. Count products = COUNTX(Metrics,[Request Quantity]) Some of the products repeat within the country and customer, but I want to count visible number of products. Also I tried to calculate the average of the Days past request date but it gives me very high number, so I suppose it takes data from the whole table and I wanted to have it only for the data from the table. Days past request date = DATEDIFF('Time - Requested By'[Requested By Date],TODAY(),DAY) Avg = AVERAGEA('Time - Requested By'[Days past request date]) I would appreciate any help.Solved4.3KViews0likes15CommentsCount number of Customers, that only have one Record - last 31 days
Hello PowerBi Guru's A simple (I think) friday struggle 🙂 So, i'm using current Dax-measure to tell me, at all time in total, how many customers has only one record: COUNTROWS(FILTER(VALUES('RecordTable'[customer_id]), CALCULATE(COUNT('RecordTable'[Record_id])) = 1) Now - I want to "filter" that measure, only showing how many of the customers with 1 record - in total(regardless of time) - have bought the last 31 days?. If I put the filter inside the calculate filterexpression, like this: COUNTROWS(FILTER(VALUES('RecordTable'[customer_id]), CALCULATE(COUNT('RecordTable'[Record_id]), Datesbetween('RecordTable'[Record_time],Today()-31,Today()) = 1) I will not get the correct result, as the Date-filtration is inside the calculate function, meaning that customers that have more than 1 record (but only 1 last 31 days), will be included. Tried to add an "&&" after the calculate filter, but it returns an error saying multiple values was return, where a single value is expected. Any Ideas on how to resolve this? Has to be a Dax-measure solution - slicer/filter filtration to get the specific result is not an option here.Solved4KViews0likes9CommentsCount appearance of string in a comma-separated data column does not count values after the first co
I have two tables: Products table has a single column with one product per field: List table has several columns but the column I'm interested in has fields that can have as little as one product to as much as 17, all separated with a comma and no spaces in between: The issue I'm facing and need help with is to correctly count each product either, ideally as as a measure. I tried two measures but they both gave me an incorrect count of blanks; there are no blank values either table. What I found is that both measures count only the *first* value they find in the List column and then continue counting subsequent rows: How can I correctly count all values in each field from the List table and have zero "blank" counts? Thanks!Solved3.7KViews0likes7CommentsCount number of rows in another table with same ID
Hi All I have a quite simple (I think) DAX question, that I hope you can help me with. Tried to find similar in the forum, without luck. I hav two tables: Table 1 Product Customer ReservationID A 1 123 A 5 234 B 5 234 C 7 345 C 9 456 Table 2 Customer ReservationID 1 123 2 123 3 123 4 123 5 234 6 234 7 345 8 345 9 456 10 567 11 567 12 678 There is a relation between the to tables, on Customer - Many-to-one. Now: If I have a filter on table 1 with Product = "A", I wan't to create a meassure to count how many related customers in Table2 are on a reservation where another customer bought this product. So, in above example, if I filter on product "A", I can see that 6 customers are on a reservations that bought this product and thereby my desired result is "6". If there is no filtering done on product level, I expect the result to be 11, as there is 11 customers on the reservations which have got any kind of product. (ie. reservation 234 bought two products, customer 10-12 is on reservations that are not present in table1) I've been walking around, some Countrows, including a calculate with allselected, but I haven't been able to find the solution yet. Looking forward to see your suggestions. Thanks in advance!Solved3.4KViews0likes6CommentsCreate miscellaneous/other group using count below a threshold
I've got a Line and Stacked Column Chart (using this because of Pareto line). I used to create a measure "Count". Count = CALCULATE ( COUNTROWS ( Projects ), ALLSELECTED ( Projects ), VALUES ( Projects[Points] ) ) "Project[Points]" is the Shared axis and "Count" is the Column values. Now I want to use this measure and combine any calculated values below 3 into a miscellaneous/other group. So it would be removing "M" thru "g", and creating an "other", stacking them all together. I've been using power bi for about 2 months now. So the more steps explained the better. Thank you.Solved3KViews0likes6CommentsCount Rows based on dynamic column value
Hi, I have a stacked bar chart with a line graph on and as a tooltip, I want to show the percentage value of each stack. I've tried various solutions, but to no avail. For example, for 2019, when I hover over the bottom stack, I want the tooltip to tell me that it represents XX% of uploads for non-partners that year. I've tried the solution below, but the latter part of the argument returns the total number of rows within the table, not the amount for each year. Percentage = DISTINCTCOUNT('Overview'[First_NID])/CALCULATE(DISTINCTCOUNT(Overview[First_NID]),ALLEXCEPT(Overview,Overview[First_Year]))3KViews0likes9CommentsCount rows before date with a condition
Hi there, I'm having trouble adding another conditon to a DAX - to determine the number of voluntary leavers in a specified period. For all leavers, the DAX I'm using is: var mindate = calculate(min('Calendar'[Date]), ALL('Calendar'[Date])) var maxdate = calculate(max('Calendar'[Date]), ALLSELECTED('Calendar'[Date])) var cnt = CALCULATE(COUNTROWS(Master), DATESBETWEEN('Calendar'[Date], mindate, (maxdate+1)), USERELATIONSHIP('Calendar'[Date], Master[Termination Date])) return cnt) This works just fine. However, I'm not sure how to get the calculation to work when adding in one more criteria, which would be: Master[Turnover Reason] = "Voluntary" In Excel, the equivalent formula is a simple COUNTIFS: COUNTIFS(Master!E:E,"<"&$A$1,Master!J:J,"Voluntary") [where Column E is the termination date, A1 is the start date in the series and Column J is the termination reason] Any ideas on how I can expand the DAX to accomodate counting the number of termination dates that fall in (or before) a date range where I also have a criteria that only returns those wirh Voluntary termination? Below is a simple example of the raw data table Position ID Employee ID Name Hire Date Termination Date Employee Status Company Company Code Home Department Description Turnover Reason 1 1 Example Employee 1 14/12/2021 Active Company A A11 Sales 2 2 Example Employee 2 23/04/2021 Active Company A A11 Marketing 3 3 Example Employee 3 15/07/2021 Active Company A A11 Finance 4 4 Example Employee 4 04/11/2021 23/05/2022 Terminated Company A A11 HR Voluntary 5 5 Example Employee 5 16/11/2021 Active Company A A11 Legal 6 6 Example Employee 6 17/11/2021 Active Company A A11 Sales 7 7 Example Employee 7 23/04/2021 14/06/2022 Terminated Company A A11 Marketing Voluntary 8 8 Example Employee 8 02/08/2021 Active Company B B18 Finance 9 9 Example Employee 9 01/09/2021 Active Company B B18 HR 10 10 Example Employee 10 22/09/2021 Active Company B B18 LegalSolved2.9KViews0likes4Comments