dax filter
25 TopicsMeasure that filters a table to a single row and returns text from a specified column (Excel365)
Hi there I still have a lot to learn about DAX, and have become stuck trying to develop a measure that will filter down my source table to a single row by using values in two columns and return the (text) value from a different, specified column. I have two measures that filter a table and calculate the expected values for (a) the oldest date for an unresolved service ticket and (b) the corresponding number of days elapsed after that date, but what I am unable to do is to retrieve the text value from a column for the row that table is calculating the age and date from. I've been going around and around in circles researching and trying different functions for far too long and am super confised now. I would really appreciate some help! 🙂 Most of my attempts at developing a measure result with an error message advising ~ that multiple have been supplied where a single value was expected, but by now I have failed in dozens of different ways. I've knocked up a file with dummy data and measures for reference - hope this helps with understanding my request and developing a solution. The pivot table I'm working with is used to generate statistics that are consolidated and presented as part of a dynamic and interactive 'dashboard' on another sheet; it is the "SYS" values that I am trying to populate with this measure: The image below is from the sample file provided, with the column in pink manually created to illustrate the desired result. Thanks in advance for your help!🤗Solved1.7KViews0likes4CommentsALLEXCEPT and ALL function does not work as I expected in DAX
Hi Everyone, I'm trying to use All/Allexcept functions in some calculations for some case scenarios. I was working with Qlik & QlikSense before and this is easly applicable on Qlik but I could not manage to get this done on PowerBI. This may not be applicable on powerbi or I may not achieve to do it. Eveything explained on the last page(ALL & ALL EXCEPT Examples), but I will give summary here again. (PBIX file : GoogleDriveLink) Page : ALL & ALL EXCEPT Examples What I'm trying to do is, I want to put a few measure on a table and when I make a selection from a field, I want only some calculations get affected from that selection, and some others don't. For example, I will put Master Date as dimension and 3 different calculation on the table. I will make a selection from Service Category field and only 1th. measure will be affected from that selection and others don't. Then I will make another selection from Availability field, then 2.th measure will be affected from the selection etc... I have 4 tables. Appoinment, Marketing, Utilization, Availability. All those 4 tables merged into appointment table. Measure 1: Calculation gets affected from only determined fields in the all except function. Test Appointment Qty = CALCULATE(sum(Appointment[m_appointment_qty]) ,ALLEXCEPT(Appointment ,Appointment[dim_country_id] ,Appointment[dim_country] ,Appointment[dim_master_date] ,Appointment[dim_service_category] ,Appointment[dim_promise_met]) ,Appointment[table_type]="Appointment" ,Appointment[dim_calculation_type]="Original" ) Measure 2: Calculation will not be affected from the determined field selections. Test2 Appointment Qty = CALCULATE( sum(Appointment[m_appointment_qty]) ,ALL(Appointment[data_flag]) ,ALL(Appointment[Availability]) ,ALL(Appointment[dim_day_diff]) ,ALL(Appointment[cleaner_id]) ,Appointment[table_type]="Appointment" ,Appointment[dim_calculation_type]="Original" ) Those calculations works fine if I don't put any dimension into the table but it does not work if I put any dimension. I tried it with and without FILTER function in the calculation but I could not manage this to work with FILTER function. When I put FILTER in dax formula, FILTER function does not allow me to put multiple dimensions to tell the calculation not to affect from any selection. More detailed explanation and use cases are on the page in PBIX file. I'd be so happy if you see the file and help me to write the correct DAX formula. Thanks for your support already. Table 2 Works fine but Table 1 will not be shown if I make any selection. I attached the uses cases as well.1.8KViews0likes6Commentsignore column value filter in a table visual
hello i have visual table with below fields' I'm trying to calculate the agent achievement which is made of 1- core achievement measue (which equals 90%* by new achiev% measure) 2- accessories achievement (which equals 10%* new achiev% measure) 3- total achievement (equals the sum of core achievement and accessories achievement) as you can see from the table above, i managed to to calculate the first 2 parts for core achievment and accessories achievement. the problem is when i was trying to sum the two percentages it's not working. as for [category type]= 'accessories' it will show blank in core achievment measure and for [category type]='Core' it shows blank for accessories achievement. i want to show the accessoreis achievemt '7%' instead of blank for category type ='core' so that for each core category i can sum both core and accessories achievement as belowSolved560Views0likes1CommentDynamic measure - filtered month
Hi all, Master Table: main tablewhere I have the values "Balance" per each Month/Currency. Fx Historical Rate: table that report all the exchange rates. I need to calculate the "Monthly Sales €", for example of March, as the difference betwwen YTD 03 @ 03 Act Rate - YTD 02 @ 02 Act Rate. This measure have to be dynamic, so if I filter "03" in the "Month Filter" I want to see 372 in the table. 4.660 If I filter "02" and so on. Each balance amount have to be converted using the correct exchange rate. Can you help me? Thanks in advance545Views0likes1Commentfilter columns and rows of a matrix
Hi all, Let's say I have the below dataset : Brand Value Competitor Audi 5000 No Skoda 4000 No VW 6000 Yes BMW 4000 Yes Peugeot 3000 Yes Tesla 5000 Yes BYD 4000 Yes Citroen 1000 Yes I want to create a Matrix for which in colomns I want to put all the brands that are not competitor and in rows, all the brands that are competitors. So it would look as below : Audi Skoda VW BMW Peugeot Tesla BYD Citroen Anyone knows how I can create a dax to filter my rows and columns? Thank youSolved631Views0likes2CommentsHow to make Fixed Totals & Subtotals (filter independent)
How to make Fixed Totals & Subtotals? Example (two identical matrix - just row order is different): Problem: when I filter by year or product, subtotals are recalculated, but I want to see global fixed subtotals (by another words the same subtotals as on screen above) Is it possible? Download Source FileSolved825Views0likes2CommentsTo Help understand DAX MEASURE | RANKX | Filter Context | Row Context
I am not sure how to debug or search this below issue. My Requirement in SQL : With Members_max as ( SELECT MemberID ,Ranked_risk ,Numerator ,row_number() over (partition by memberid order by Ranked_risk ASC) as Rn from FactPatient WHERE QMID in (10,11,12,13) and Year in (2022) ) Select sum(Numerator) as Numerator -- A measure for Numerator , Count(Memberid) as Denominator -- A measure for Denominator from Members_max m where m.rn = 1 Now what I am trying to do is 1. Get the Lowest Ranked Risk for each patient for the selected months (User can select One month, Multiple Months or without any filter on Date table.) 2. Fact Patient has One Entry for each member for all months with their ranked risk (Values like 1, 2,3, .etc.), Numerator will have 0 or 1. Here is the DAX measure which is working as expected without any filters VAR QM2_data = FILTER ( FactPatient, FactPatient[QMID] IN { 10, 11, 12, 13 } ) VAR QM2_Dataset = ADDCOLUMNS ( QM2_data, "Rn", RANKX ( QM2_data, FactPatient[Ranked_Risk],, ASC, SKIP ) ) RETURN SUMX( FILTER ( QM2_Dataset, [Rn] = 1 ) ,FactPatient[NUMERATOR] ) The measure is not working as expected when we apply any filter on Date table. Data sample: Member ID Ranked Risk Numerator Month QMID 1 2 0 2022-10-31 10 1 1 1 2022-09-30 11 1 3 1 2022-08-31 11 2 1 1 2022-09-30 10 2 2 0 2022-08-31 10 3 1 0 2022-08-31 11 3 2 0 2022-07-31 11 Case 1 : When No filter applied, it is expected to pick the lowest ranked risk for each member that would be the below table MemberId Ranked Risk Numerator Date QMID 1 1 1 2022-09-30 11 2 1 1 2022-09-30 10 3 1 0 2022-08-31 11 and the dax measure for numerator would yield a value of 2. Issue part: Now, if we select a month let's say August, 2022. I was in an assumption that Numerator will be 1 after filter the dataset to Aug, 2022 and then do a ranking to arrive at following temp table tbale to do the sumX. Member ID Ranked Risk Numerator Month QMID 1 3 1 2022-08-31 11 2 2 0 2022-08-31 10 3 1 0 2022-08-31 11 But Dax expression is not evaluated on top of current filter context(Aug,2022), instead the current filter context is only applied in the last step to filter the data(Bolded) after getting the Numerator value for each month i.e in our example Month Numerator Oct, 2022 1 Sep, 2022 1 Aug, 2022 0 Thus getting Zero as value rather than 1. Summary: I want this DAX expression to calculate the rank on top of current filter expression and do the some. Could anyone help me get to understand what am I doing wrong?Solved4KViews0likes18CommentsSUMIFS in DAX without relationship
Is there any way where we can use SUMIFS in DAX without the relationship present. I have two tables Table 1 Table 2 I know for a fact that most of them would ask me to relate the table above as there is one to many relationship. If there are multiple columns and I have to do validation based on criterias then I would use SUMIFS. Can anyone help me down with the expression for bringing values from table 2 to table 1?Solved7.5KViews0likes13CommentsXIRR where investment is in seperate table
I have cash flows in the form of unpivoted data like this: Table: CF ID Key Date Value Year 1 Revenue 31/12/2022 10 2022 1 EBITDA 31/12/2022 1 2022 1 Revenue 31/12/2023 100 2023 1 EBITDA 31/12/2023 80 2023 1 Revenue 31/12/2024 220 2024 1 EBITDA 31/12/2024 95 2024 1 Revenue 31/12/2025 310 2025 1 EBITDA 31/12/2025 250 2025 1 Revenue 31/12/2026 320 2026 1 EBITDA 31/12/2026 255 2026 1 Revenue 31/12/2027 550 2027 1 EBITDA 31/12/2027 490 2027 1 Revenue 31/12/2028 520 2028 1 EBITDA 31/12/2028 470 2028 2 Revenue 31/12/2022 80 2022 2 EBITDA 31/12/2022 40 2022 2 Revenue 31/12/2023 120 2023 2 EBITDA 31/12/2023 98 2023 2 Revenue 31/12/2024 450 2024 2 EBITDA 31/12/2024 390 2024 2 Revenue 31/12/2025 880 2025 2 EBITDA 31/12/2025 800 2025 2 Revenue 31/12/2026 460 2026 2 EBITDA 31/12/2026 420 2026 2 Revenue 31/12/2027 700 2027 2 EBITDA 31/12/2027 640 2027 2 Revenue 31/12/2028 920 2028 2 EBITDA 31/12/2028 845 2028 2 Revenue 31/12/2029 550 2029 2 EBITDA 31/12/2029 480 2029 The investments are stored in a seperate table, where there for each ID is the investment and investment date: Table: Investments ID Investment Investment date 1 -1200 01/06/2021 2 -1500 01/08/2021 The tables are related by the ID. I am trying to create a DAX measure to calculate the IRR for each ID, using the XIRR formula. This is the results (from Excel): ID 1 Date 01/06/2021 31/12/2022 31/12/2023 31/12/2024 31/12/2025 31/12/2026 31/12/2027 31/12/2028 EBITDA -1200 1 80 95 250 255 490 470 IRR = 5,37% ID 2 Date 01/08/2021 31/12/2022 31/12/2023 31/12/2024 31/12/2025 31/12/2026 31/12/2027 31/12/2028 31/12/2029 EBITDA -1500 40 98 390 800 420 640 845 480 IRR = 17,45% I have tried various methods to calculate the IRR with XIRR (e.g. CALCULATE, UNION, SUMX, etc.), but I nothing have worked to far. In my head it seems simple, just append the investment to the EBITDA line and investment date to te Date line.Solved1.1KViews0likes4Comments