"filter"
62 TopicsStruggling to apply filters in my DAX
Hello, I'm really struggling on how to make my slicers work. So, I have an Employment table, with two date columns: Hire Dates and Termination Date. I have an active relationship with my Calendar[Date] and Employment[Hire Dates], and an inactive relationship with my Calendar[Date] and Employment[Hire Dates]. Below is my current DAX formula. My problem is, if I add the a Job Title or Location in my slicer or in my visuals, it doesn't work correctly. Both these columns can be found in my Employment table. Please let me know what I'm doing wrong. Thank you! Opening Headcount = VAR PeriodStartDate = MIN('Calendar'[Date]) // Gets Jan 1st of the selected period RETURN CALCULATE( COUNT(Employment[Employee #]), FILTER( ALL(Employment), // 1. Must be hired ON or BEFORE the start of the period Employment[Hire Date] <= PeriodStartDate && // 2. Must NOT be terminated BEFORE the start of the period // Logic: Either termination is blank OR it happens AFTER the start date ( ISBLANK(Employment[Termination Date]) || Employment[Termination Date] >= PeriodStartDate ) ) ) daxSolved573Views0likes2CommentsVisuals Break with "Error Fetching Data" When Filtering by Date (Import Mode Model)
Hi everyone, I’m facing an issue in Power BI where visuals break and display an “Error fetching data for this visual – An unexpected error occurred” message whenever I try to apply a date filter (as shown in the attached screenshot). Here are the key details: The data model is in Import mode. The error appears specifically when filtering data on TransactionDate (or any date column). The visuals work fine before applying the date filter. I’ve already tried refreshing the dataset and rebuilding the visual, but the issue persists. Has anyone else experienced this issue or found a solution/workaround for it? Any guidance would be appreciated. Thank you!Solved4.2KViews0likes16CommentsWith or Without FILTER in measure
I'm a bit confused about the FILTER function There're two tables: Date (with a one-to-many relationship) → Revenue Sunday is the first day of week. Assume today is 5 Jul 2025 (Sat). I need to create a table to compare revenue for current week (29 Jun - 5 Jul 2025) vs same week last year (30 Jun - 6 Jul 2025). I’ve disabled the start date selection in the date slicer to prevent users from selecting an incorrect start date, which could disrupt the prior year calculation. There is a column - First Day of Week_RankDESC which ranks the first day of each week in descending order, so current week is MIN('Date'[First Day of Week_RankDESC]) I have two questions. 1. Why are the results different between the two measures below? I thought both were filtering the rank to the current week. e.g. CurrentYearWeekRank = MIN('Date'[First Day of Week_RankDESC]) Without FILTER CALCULATE(SUM(Revenue[Revenue]), 'Date'[First Day of Week_RankDESC] = CurrentYearWeekRank) FILTER CALCULATE(SUM(Revenue[Revenue]), FILTER('Date', 'Date'[First Day of Week_RankDESC] = CurrentYearWeekRank)) 2. If I select end date - 2 Jul 2025 (Wed), both tables still show revenue for Thur, Fri, Sat for current week. Why? Thanks in advance:) https://drive.google.com/file/d/1n0UqUtWKyvxoL_0XuEqJY18ZzZzTzlwU/view?usp=sharingSolved2.2KViews0likes12CommentsHelp Calculating Average Excluding 2 Conditions
I have an existing DAX measure which gets average of completed fields in the "Master AE" table (there's 35 required fields): [EPIC %] = CALCULATE( DIVIDE([EPIC Points], COUNTROWS('Master AE')*35)) The current measure gives this output on my KPI cards, which is correct: However, I need to modify it to get a new average that EXCLUDES any rows where Master AE [EPIC Points Count] is <=17 AND the Master AE [Quarter] is > 2. Or basically, exclude any results from EPIC % measure result <= 49% AND Quarter > 2. The desired result average should be 40.28% (only 10 values would be averaged per the conditions) Any idea how I can do this? Here is the [EPIC points] measure which sums all the points assigned when blanks completed: Appreciate any help!Solved1.1KViews0likes5CommentsDAX help calculating Repeat Customers
Hi, I’m working in Power BI and trying to create a DAX formula to classify purchasers as either Repeat Customers or Single Customers based on their Customer ID and the dates they made purchases. For example: If a customer makes multiple purchases on the same date (e.g., 5/1/2025), they are considered a Single Customer. If they make purchases on multiple different dates (e.g., 5/1/2025 and 5/2/2025), they are classified as a Repeat Customer. If I were doing this in Excel, I would use a Pivot Table to distinct count the number of purchase dates per Customer ID, then use a COUNTIF to determine how many customers have only one purchase date (Single Customer) versus more than one (Repeat Customer). This is what I’m trying to replicate using DAX in Power BI. These are the DAX formulas I've tried: Single_Customers = COUNTROWS(filter(DISTINCT('Sales'[Customer ID]),CALCULATE(COUNT('Sales'[Sales Date]))=1)) Repeat_Customers = COUNTROWS(filter(DISTINCT('Sales'[Customer ID]),CALCULATE(COUNT('Sales'[Sales Date]))>1)) Single_Customers = COUNTROWS( FILTER( VALUES('Sales'[Customer ID]), CALCULATE(DISTINCTCOUNT('Sales'[Sales Date])) = 1 ) ) Repeat_Customers = COUNTROWS( FILTER( VALUES('Sales'[Customer ID]), CALCULATE(DISTINCTCOUNT('Sales'[Sales Date])) > 1 ) ) Here is some sample data. If I did this in excel with a pivot table and distinct count it, I'd have 5 Single Customers and 1 Repeat Customer. Customer ID Sales Date 3808 2/11/2025 1833 5/16/2025 3808 2/11/2025 2879 2/11/2025 1727 5/16/2025 1727 4/18/2025 2036 2/11/2025 1128 4/18/2025Solved3.5KViews0likes7CommentsRanking with RANKX, FILTER, ALL & CALCULATE not working in Direct Query mode
Has anyone had issues ranking using Direct Query vs import modes? I am using the following measure which works when the table is imported but not in direct query mode: Rank Test = RANKX( FILTER( ALL( accounts[last_program_size], accounts[program_size] ), accounts[last_program_size] = MAX(accounts[last_program_size]) ), CALCULATE( sum(accounts[count_flag]) ) ) A number of the functions used have this remark in the official documentation but I am not using it in a calculated column and do not have RLS configured. This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules. Thanks.Solved2.4KViews0likes11CommentsAdding Condition to SWITCH function for Call Center
Hi! I have a measure that calculates Total Calls, depending if an Advisor or Date is selected in a slicer. It will calculate SUM of Total Calls using an inactive relationship between the two tables. UpdatedProd521 = sales table Combined Call Logs 5/17 = call logs table Inactive relationships between [Date] And [Advisor] columns I need help to add a new argument that outputs SUM total from the Updated Call Logs 5/17[Calls] column if a single Advisor AND single Date are selected using the relationships between the two tables. Here is the syntax I used that currently works if either Advisor or Date are selected: Total Calls Dynamic = SWITCH( HASONEVALUE(UpdatedProd521[Advisor]),TRUE(), CALCULATE( SUM('Combined Call Logs 5/17'[CALLS]),USERELATIONSHIP(UpdatedProd521[Advisor], 'Combined Call Logs 5/17'[ADVISOR]) //When an advisor is selected ) ,NOT HASONEVALUE(UpdatedProd521[Advisor]) && (NOT ISBLANK(MAX('UpdatedProd521'[Date]) || NOT ISBLANK(MAX('Combined Call Logs 5/17'[DATE])))),TRUE(), CALCULATE(SUM('Combined Call Logs 5/17'[CALLS]), USERELATIONSHIP('Combined Call Logs 5/17'[DATE], UpdatedProd521[Date]) //When date is selected )Solved1.4KViews0likes6CommentsToolTip Advance - Filter Help
Hi all, I'm working on a Power BI report where I show monthly Gross Sales in a table and would like to display a tooltip chart when hovering over the table rows. The goal of this tooltip is to show the entire year's trend line for Gross Sales, not just the single month that was hovered. What I want: When hovering over a row (e.g., Brand 3), I want the tooltip to show a Bar chart for the full year (e.g., Jan–Dec ). The tooltip should still respect other slicers from the main page: e.g., State but ignore Month Slicer What I’ve Tried: Created a Tooltip Page. Enabled the page as a tooltip and linked it to the table. It works — but only shows a single month (the row context from the table). However, the date context from the hovered row still dominates the chart axis — only one Bar appears instead of the full year. What I Need Help With: How can I structure my tooltip chart (and DAX) to: Ignore just the row-level month/date from the hovered row Still respect the full context of slicers (State etc.) Always show the full year trend on the tooltip chart? File workingSolved586Views0likes2CommentsFilter for Common years in DAX
I cant get my head around how to do this... I want to filter the table for only the years that the projects have in common. I wont know how many projects are in the table or what the common years are. I just want the common years so I can add the rent values together and calculate annual yoy rent growth for properties that existed in those years. Table Property rent year Project 1 50 2020 Project 1 100 2021 Project 1 120 2022 Project 1 110 2023 Project 1 105 2024 Project 1 125 2025 Project 1 100 2026 project 2 600 2021 project 2 550 2022 project 2 580 2023 project 2 570 2024 project 2 490 2025 project 3 800 2021 project 3 825 2022 project 3 875 2023 I would want this result Expected Result Property rent year project 3 800 2021 project 3 825 2022 project 3 875 2023 project 2 600 2021 project 2 550 2022 project 2 580 2023 Project 1 100 2021 Project 1 120 2022 Project 1 110 2023Solved1.6KViews0likes9CommentsCalculate sum of items based on date range and avaliable stock
Hey everyone, hope you all well. I'm new in the power bi, and having lots of trouble allready, can you help me with a situation? I need to set a status to the items of different orders based on its date and comparation between the stock and the quantity needed. Example: i have three tables called: date, with comun: date; orders, with columns: order number, item, quantity and date; and stock that has columns: item, quantity. they have for example the following data: Table date: date 01/01/25 02/01/25 03/01/25 Table stock: item quantity aaa 20 bbb 10 Table orders: Order num Item quantity date 111 aaa 20 01/01/25 111 bbb 10 01/01/25 222 aaa 10 02/01/25 333 aaa 20 03/01/25 333 bbb 2 03/01/25 i need a way of creating a graphic table to show, as i select a range of date in data segmentation for example: i select a range from 02 to 03/01, then based on the available stock, the status of the order number 222 will be: item aaa"available", and the other 333 item aaa will be "out" and the order 333 item bbb will be "available" but if i do not select any range and leave it all the dates selected, it will be: order 111, items aaa and bbb will be atatus "available" and the others will be "out". I also need a way to count all the "available" and "out" and i need to be able to select if i wanna se only the evailable or the out status. i don't know if i made myself clear, but could you help me please? Thankyou a lot.Solved2.6KViews0likes7Comments