countrows
61 TopicsLogic query for IF, AND, || with CALCULATE and COUNTROWS function
Hi all, I am sure this is very simple, but I am really struggling with this bit of logic for CALCULATE, COUNTROWS & FILTER Functions. I have the following table called 'Test' Type Actual End Planned End 1 22/10/24 1 22/10/24 2 25/10/24 3 23/10/24 4 22/10/24 If today was the 31st Oct, then I would like to count all of the rows (that were last week of the 31st Oct) as per the conditions below. The result that I am hoping to achieve would be 5 i.e counting all of the rows above with dates. I want to do the following calculation for everything that is 'type' = "1", "2", "3" Completed Lasttwk = CALCULATE( COUNTROWS(test), FILTER( test, test[Status] = "Completed" && WEEKNUM(test[Actual End]) = WEEKNUM(TODAY())-1 && YEAR(test[Actual End])=YEAR(TODAY()) ) ) However if 'type' = "4" then do the following Completed Lasttwk = CALCULATE( COUNTROWS(test), FILTER( test, test[Status] = "Completed" && WEEKNUM(test[Planned End]) = WEEKNUM(TODAY())-1 && YEAR(test[Planned End])=YEAR(TODAY()) ) ) I am looking for a sum of the COUNTROWS for both of the above calculations. Any ideas how i can apply this logic to correctly COUNTROWS of the 'Test' table. Any ideas gratefully receivedSolved693Views0likes2CommentsCOUNT/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 Rows in Visual
I want to count rows in a Matrix visual. The row count would change based on what is selected in the slicers. I want to put the count in a card that will change dynamically based on what is selected in the slicers. The categories I have are Location and # of Sales. I tried Count(Location), but I keep getting the error "parameter is not the correct type". I tried CountRows, which asks for the table. What table? Location comes from one table and # Sales comes from another table! I'm new to this, but in Excel it's SO EASY. How can I make this work please?Solved2.4KViews0likes6CommentsHow to count rows of filtered table based on slicer selection
I have the following table below. The months are ordered according to the [Date Rank] column with 1 being the most current month. I have a 1 measure that selects the previous month. So if March is selected, the measure is 3. If Apr is selected, the measure is 2. How can I make a measure to count the number of items/rows in the previous month and place in a card visual. So if Apr is selected as the current month, I want to count the number of rows where Date Rank = 2. And the answer would be 5 since there are 5 rows for march. I also have the following code below, but it looks like my current CALCULATE(COUNTROWS statement does not work because every time I select a month with a filter, the car visual just shows blank. It works when I pass the function a number, but not with the variable. Thank you for any help on solving this. ID Status Date Rank Month A Not Late 3 Jan B Not Late 3 Jan C Finished 3 Jan D Not Late 3 Jan A Not Late 2 March B Re-opened 2 March C Late 2 March D Late 2 March E Late 2 March A Late 1 Apr B Late 1 Apr C Late 1 Apr Slicer I have to select month: First measure I have to select the date rank of the previous month: Daterankofpreviousmonth = VAR currentselecteddaterank = SELECTEDVALUE('Table'[Date Rank]) RETURN IF( ISBLANK(currentselecteddaterank), BLANK(), currentselecteddaterank + 1 ) My current measure to count the number of rows where Table[Date Rank] = daterankofpreviousmonth. But this does not work. The card visual just shows blank. Countprevious = VAR currentselecteddaterank = [Daterankofpreviousmonth] RETURN IF( ISBLANK(currentselecteddaterank), BLANK(), CALCULATE( COUNTROWS('Table'), 'Table'[Date Rank] = currentselecteddaterank ) )1.7KViews0likes3CommentsDifferences COUNTAX and COUNTROWS
Hi everyone, I am currently doing the Master DAX course by SQLBI. In exercise 03.30, I attempted a solution with COUNTAX but this yielded a different result than the actual solution that used COUNTROWS. Apparently, I am missing something that I need to consider when applying COUNTAX. The task in 03.30 is as follows: Create a # CustWithChildren measure that computes the number of customers with children – only consider customers where Customer[Total Children] is greater than zero. My DAX is as follows: #CustWithChildren (Me) = countax( customer, Customer[Total Children] >0 ) You can find the PBI file for exercise 03.30 here . Can someone please explain to me why my attempt did not arrive at the correct numbers? Thanks in advance!Solved1.1KViews0likes3CommentsMultiple COUNTROWS?
Hey team, I'm a chimp at a typewriter trying to lean into PowerBI. Not terrifically experience with DAX, but am the desinated 'data' person. Is it possible to sum multiple Countrows? An active participant in a program is assined a value of 5, whereas a passive participant is assigned a value of 2? CALCULATE (COUNTROWS('DataTable'), FILTER('DataTable','DataTable'[Status]="Active" &&'DataTable'[Program]="Program1"))*5 Then I'm assuming the second half would be something to the effect of: CALCULATE (COUNTROWS('DataTable'), FILTER('DataTable','DataTable'[Status]="Passive" &&'DataTable'[Program]="Program1"))*2 Am I able to get a sum of the total? The value assigned depends on the program, and it spans across a couple of programs. If anyone could steer in the right direciton, I'd be very appreciative! Back to Googling for now!Solved664Views0likes2CommentsCount records with Measure as a Filter
Hello - I got stuck in something that I thought was simple. I have a simple table that looks like this: Date ID Jan 3 ABC001 Jan 3 ABC002 Jan 2 ABC002 Jan 1 ABC001 Jan 1 ABC003 This table is filtered based on the selections made on 2 date slicers (Date 1 and Date 2). The selection on Date 1 will output only the date selected, while the selection on Date 2 will create a flag if the ID is in both selected days. For example, if I apply the following selections Date 1 = Jan 3 and Date 2 = Jan 2, the table will look like this: Date ID Flag Jan 3 ABC001 No Jan 3 ABC002 Yes ABC001 is not on Jan 2, that's why Flag = No. How can I count only the records where Flag = No ? I thought it was as simple as combining CALCULATE or COUNTROWS and FILTER, but considering that Flag is a Measure I cannot make it work. Thanks in advance! DavideSolved828Views0likes3CommentsCOUNTROWS Not Working After Filter Pane
Hi Guys, HOWMANYLEFT = COUNTROWS(wyscout_bio_data) I have a matrix visual in my report. When filtering is done through Slicer, the above formula tells how many rows are left in the table. However, when filtering through the filter pane, the number does not look correct. What should I do?820Views0likes3CommentsURGENT!! Get Sum of rows by grouping based on column
Hello, Power Bi community! I need some help with the below code: Can you modify this dax code such that every df_Brands[Category Purchased] value, gives me a different Total Sum, So in simple words it groups by the count rows of the df_Brands table based on the df_Brands[Category Purchased] column. TotalSum_CategoryOccasions_MultiSelect_Part2 demo = CALCULATE( SUMX( VALUES(Respondent[Unique_ID]), VAR OccasionsYes = CALCULATE(COUNTROWS('df_Occasions'), 'df_Occasions'[value1] = "Yes") VAR CategoryYes = CALCULATE(COUNTROWS('df_Category Purchased'), 'df_Category Purchased'[value] = "Yes") RETURN IF( OccasionsYes > 0 && CategoryYes > 0 && ( COUNTROWS(FILTER(Respondent, Respondent[IsBrands] = TRUE())) > 0 ), 1, 0 ) ) ) @MFelix , @amitchandak , @Ashish_Mathur1.2KViews0likes5CommentsHow to count the row count matching the selected data set, where the issue type match
Hi, I have built a star schema as below. I have two flat files loaded as test_execution_summary and defect_report. Records in the test execution summary is filtered using the practice name and then again the project name. After that I am using a visual filter to filter in cycles related to the recent release, which I calculate through a measure. Relationships between tables are as follows: - defect_report[IssueKey] = test_execution_summary[ExecutionDefect] - test_cycle_details[cycleID] = test_Execution_summary[CycleID]] In the defect table there are two types of issues, bugs and defects. I need to calculate the bug count of each cycle, selected for the latest release. I tried to use below measure, but it is making the bug count value empty. Bugs Count 1 = CALCULATE(COUNTROWS(FILTER(defect_report, defect_report[Issue Type]="Bug")), RELATEDTABLE(test_execution_summary)) I have been trying different ways to get this to work, but i can't figure out the way. I am totally new to Power BI. Appreciate if someone can help me to figure out what i am doing wrong and how to fix this.526Views0likes2Comments