allselected
38 TopicsAll Selected is not working properly, I have to include another Column
Hello, I have a fact table that has multiple colums: Item,Period_Name,Period_ID,Sales Period name is like Jan 2022 , Feb 2022 etc Period_ID is like 202201 , 202202 etc I created one slicer in the dashboard that has "Period_Name" Field and created 1 grid in the dashboard in which I want to include 4 columns: Item, Period, Sales Value, Sales value (for the all selected periods) , Sales Value (for all the periods selected and unselected) I created the measures like this Total Value Sales = CALCULATE(SUM(Fact_Sales[Value Sales])) Total Value Sales (Selected Period) = CALCULATE([Total Value Sales], ALLSELECTED(Fact_Sales[Period])) Total Value Sales (Ignore Period) = CALCULATE([Total Value Sales], ALL(Fact_Sales[Period])) But I got wrong results like the image I tried so much to solve it and solved successfully by changing in the measures Total Value Sales (Selected Period) = CALCULATE([Total Value Sales], ALLSELECTED(Fact_Sales[Period]),ALLSELECTED(Fact_Sales[PERIOD_ID])) Total Value Sales (Ignore Period) = CALCULATE([Total Value Sales], ALL(Fact_Sales[Period]),ALL(Fact_Sales[PERIOD_ID])) As you can see, numbers now are reflecting correctly... but I am unable to understand the behaviour, why it didn't work although I am not using this Period_ID column anywhere? also I wanted to create another sheet with dummy data to upload here to the community to make things easier, but surprisingly it worked successfully without adding the second condition. Does anyone have a clue? Thanks. John ElmasrySolved2.2KViews0likes3CommentsALLSELECTED but include other filter
Hi Folks, I have a problem with the VALUES() fuction. I am creating a linechart showing a price-index. So the chart always starts at 1 and e.g. goes down to 0.98 when the price drops by 2%. I am doing this for every my materials and aggregate an average to show this aggregated line. So in short I want to do this: per Material divide the price by the first price My Dax formula looks like this: Freight Surcharge Index = AVERAGEX( VALUES(AML_PRICE_DATA_FACT_PURCHASING_PRICES[Material No]) , DIVIDE( SUM(AML_PRICE_DATA_FACT_PURCHASING_PRICES[Freight Surcharge]) , CALCULATE( // Here it ignores the VALUES Grouping FIRSTNONBLANKVALUE(AML_PRICE_DATA_FACT_PURCHASING_PRICES[Report Dt],SELECTEDVALUE(AML_PRICE_DATA_FACT_PURCHASING_PRICES[Freight Surcharge]) ) ,ALLSELECTED(DIM_Calendar[Date]) ) ) ) unfortunately in the CALCULATE part it seems to ignore the grouping by [Material No] Propably because of the ALLSELECTED(DIM_Calendar[Date]) But I need this to excape the Date Dimension in the chart and get the first value. How can I escape the Date Dimension in the Chart but keep the grouping of [Material No]?Solved822Views0likes4CommentsTrying to Get a Max Rate for a Customer, filter that rate and see all open Accounts for Customer
I am working on a report on which I want to filter our customers by a Rate Variance Group. The customer would fall into a group based on the Max Rate Variance for all of their deposit accounts. But, if a customer falls in that range I want to see all open accounts for the customer so I can evaluate the total relationship. To do this I used "All Selected" so I can see all accounts for the customer. The issue is that now I cannot filter the "Closed Accounts". I have what you see in the example below and I have a slicer with a Rate Variance Groups is working. Example: Customer Name Account Number Account Status Max Rate Variance Rate Variance for Deposit Account ABC Company 123456 Open 1.25 .75 ABC Company 85755 Open 1.25 1.25 ABC Company 22225 Closed .25 .50 This is my current DAX establishing my slicer and my "Max Rate Variance" calculation. MaxRateVariance = VAR low = SELECTEDVALUE('Group-Deposit Rate Variance Group'[Low Range]) VAR high = SELECTEDVALUE('Group-Deposit Rate Variance Group'[High Range]) VAR cust = SELECTEDVALUE('Account Common'[Customer Number]) Var calc = MAXX( CALCULATETABLE( VALUES('Account Common'[Account Number]), ALLSELECTED('Account Common'[Account Number]) ), [Rate Variance (Deposits)] ) VAR result = SWITCH(TRUE(), calc >= low && calc <= high, calc ) Return IF(HASONEVALUE('Account Common'[Customer Name and Customer Number]), calc, BLANK() )Solved854Views0likes4CommentsWriting measure to show multiple visuals on the same chart with one slicer
Hello, I am sorry to keep posting looking for a solution on this. I am trying to write a measure. I have tried multiple methods but cant get anything to work. I would assume having two different measures on the same visual would work. I have two tables (Table1 and Table2). My goal is to use one slicer and show multiple visuals from the same table on the same chart. For example, if a month is selected, I want to show data (filtered with different conditions) for that month, and the month most recent to the selected month. Column 'Table1'[Month] is linked to Column 'Table2'[Month] with a one to many relationship (Table2-one, Table1-many). Then I have a slicer that uses column 'Table2'[Month]. The visual for my current month works, but now I am trying the add the data to the same visual for its previous month. For the previous month, If the user selects a month with the slicer, I want to save the [Previous Month] associated in Table2 column as text. So if 24-Jun is selected, I want to save "24-May" as text. Then I want to filter and count the number of rows in Table1 where [Month End] = the saved text & Type = "Task". So in this example, I would count the number of rows in Table1 where Table1[Month End] = "24-May" & Type = "Task", and this would return 1. Table1 ID Status Date Rank Previous Status Month Type Group Previous Month A Normal 3 No previous 24-Mar Task <0 No previous B Normal 3 No previous 24-Mar Task 1 to 5 No previous C Not Normal 3 No previous 24-Mar Task 1 to 5 No previous D Not Normal 3 No Previous 24-Mar Not Task 11 to 15 No previous A Not Normal 2 Normal 24-May Task 6 to 10 24-Mar B Normal 2 Normal 24-May Not Task 6 to 10 24-Mar C Normal 2 Not Normal 24-May Not Task 6 to 10 24-Mar D Not Normal 2 Not Normal 24-May Task 6 to 10 24-Mar A Not Normal 1 Not Normal 24-Jun Task 1 to 5 24-May B Not Normal 1 Normal 24-Jun Task <0 24-May D Normal 1 Normal 24-Jun Task <0 24-May E Normal 1 24-Jun Task 1 to 5 24-May Table2 Date Rank Month Next Date Rank Previous Month 3 24-Mar 4 2 24-May 3 24-Mar 1 24-Jun 2 24-May Sample of visual I'm trying to create: Measure that doesn't work for previous month: (I keep getting blank when selecting a current month) VAR SelectedMonth = SELECTEDVALUE('Table2'[Month]) VAR PreviousMonth1 = CALCULATE( MAX('Table2'[Previous Month]), FILTER( ALL('Table2'), 'Table2'[Month] = SelectedMonth ) ) VAR CountRows1 = CALCULATETABLE( 'Table1', FILTER( ALLSELECTED('Table1'), 'Table1'[Month] = PreviousMonth1 && 'Table1'[Type] = "Task" ) ) RETURN COUNTROWS(CountRows1) Measure works for selected month: VAR SelectedMonth = CALCULATE( MAX('Table1'[Date Rank]), FILTER( ALL('Table1'), 'Table1'[Month] = SELECTEDVALUE('Table2'[Month]) ) ) VAR _tablecalculation = CALCULATETABLE( 'Table1', ALLSELECTED('Table2'), 'Table1'[Date Rank] = SelectedMonth, 'Table1'[Status] = "Not Normal", 'Table1'[Previous Status] = "Not Normal", 'Table1'[Type] = "Task" ) RETURN COUNTROWS(_tablecalculation) Any help in the right direction is definetly appreciated!Solved1.3KViews0likes4CommentsWhy doesn't ALLSELECTED work? Slicer issue
Hi, I have the following ProductTable with the column Status: Status Done Ongoing Ongoing Done Ongoing Done Done Done Delayed Delayed I'm trying to create a card visualiation for each status (Done, Ongoing, Delayed) to show % of total. I have created three measures, this one is for Done (the others is simply a copy paste using Ongoing and Delayed instead): Var_DonePercentage = DIVIDE( CALCULATE( COUNTROWS(ProductTable), ProductTable[Status] = "Done" ), CALCULATE( COUNTROWS(ProductTable), ALLSELECTED(ProductTable[Status]) )) This works as long as I don't filter anything, see below. However when I select for example "Done" in the slicer, the others should be 0% to avoid confusion. How can I make this happen?Solved1.1KViews0likes3CommentsALLEXCEPT 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.8KViews0likes6CommentsCount 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.3KViews0likes6CommentsPrevent Offset being filtered
Hi, I'm trying to create a measure for compared to same period last year (I can't use the normal time intelligence as we use 13 periods in the year). I am using offset to get the value for 13 periods prior, which works perfectly until I try to filter the data - it blanks. I've tried replacing the ALLSELECTED with ALL but then the OFFSET breaks. CALCULATE( [% Accum YTD Joiners (Heads)], OFFSET( -13, ALLSELECTED('Reporting DimDate'[Short_RSP],'Reporting DimDate'[Short_RSPYear]) ,ORDERBY('Reporting DimDate'[Short_RSPYear], ASC ) ) ) I want to filter this by DimDate595Views0likes2CommentsKeep results from a matrix visual when using slicers and a measure with ALLSELECTED
Hi, I have this visual matrix where I show some results from a measure: The measure used is: Measure = SUM('Table1'[Results]) / CALCULATE( SUM('Table1'[Results]) , ALLSELECTED('Table1'), VALUES('Table1'[Date])) What I need is, when I use a slicer for the column "Shipper" and select a value, I need to keep the results of the previous image, (is the scenario where I don't select any slicer value): When I select a value from the slicer, the matrix will return this: The Table1 is something like this (the 'results' are just examples): Shipper Date Results SHIPPER 1--- jul/22--- 102 SHIPPER 2--- jul/22--- 408 SHIPPER 3--- jul/22--- 502 SHIPPER 4--- jul/22--- 42 SHIPPER 5--- jul/22--- 4 SHIPPER 6--- jul/22--- 21 SHIPPER 7--- jul/22--- 525 SHIPPER 1--- ago/22--- 78 SHIPPER 2--- ago/22--- 213 SHIPPER 3--- ago/22--- 210 SHIPPER 4--- ago/22--- 802 SHIPPER 5--- ago/22--- 20 SHIPPER 6--- ago/22--- 17 SHIPPER 7--- ago/22--- 43 etc...--- etc...--- etc... Thank you for your help, community,Solved1.4KViews0likes1Commentcreate a measur with a filter ignoring filter on the page level
i have created a measure that calculates a oercentage with a filter. i have the same filter in my table visual but i want to ignore the filter that is in the visual and apply the filter in the measure. example: accessories achievement = calculate(achievement * .1 , category[type]= accessories, all(category[type)) my table visual should show the below category type core achievement accessories achievement gross aad core 94 8 renewal core 90 7 note: there's a filter on page level for the column type=core. i want to show accessories achievemnet with type= accessories ignoring this page level filter= core. currently with the measure i created above, accessories achievement is showing blank.657Views0likes3Comments