allexcept
34 TopicsSUMX Group By Multiple Categories
I have this table, which shows the correct results in Total By ID and Month. UniqueID0 DateClosed TotalHoursClosed Total By ID and Month 1 9/30/2024 8 8 1 10/9/2024 8 12 1 10/10/2024 4 12 2 10/9/2024 8 16 2 10/9/2024 8 16 3 9/30/2024 4 4 3 10/9/2024 4 4 If I use this I get the equivilant of Total Hours Closed Column. TotalHoursByIDandMonth = Calculate(SUMX(VALUES('BCP (2)'[UniqueID0]),[TotalHoursClosed]),GROUPBY('BCP (2)','BCP (2)'[UniqueID0],'BCP (2)'[DateConversion])) Even though it's not making sense because I've read that ALLEXCEPT just removes filters, and I don't have any filters, but it's closer to what I need-it sums by UniqueID0 but doesn't take into consideration the date, so the first 3 rows e.g. equals 20: TotalHoursByIDandMonth = Calculate(SUMX(VALUES('BCP (2)'[UniqueID0]),[TotalHoursClosed]),ALLEXCEPT('BCP (2)','BCP (2)'[UniqueID0],'BCP (2)'[DateConversion])) [DateConversion] is a Calculated Column DateConversion = EOMONTH('BCP (2)'[DateClosed],-1)+1 How would I sum this grouping by UniqueID0 and DateConversion(FirstOfMonth)?Solved2.3KViews0likes10CommentsALLEXCEPT 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.8KViews0likes6CommentsAllexcept issues in a herarchy
Hello to everyone, hoping you're doing great. Have you ever had an issue with Allexcept ? Let me explain my problem: In this table, being specific the column "$ Var to Program Avg", I'm using and ALLEXCEPT to get the avg of the values by program in "Unit Calculation" (row 4 equal to 5.36) less (-) Avg Calculation = $ Var to program Avg (5.48 - 5.36 = 0.11). This calculation is good, the issue is that at the program level ("10.00-IN Foxtail Fern"), the value is equal to 0.00 when I whould like to have the sum of the variance at the program level in $ Var to program Avg to sort it and know which one should we look first (There are too many programs). This is an example: Unit Calculation This is the $ Var to program Avg:Solved426Views0likes1CommentFew Slicers to work on measures and few are not
Hi, I am facing an issue with creation of DAX. I have got a request from the client where we have a slicer of an Item and Provider at the top of dashboard. I have to show all to KPI for that Item and Provider selected. Further I have all the other dimension filters like Country, City, Corporate group etc. Then I have to create a DAX wherein I have to find the median of my measure amount of the selected Item and Provider. Another measure I have to create is Median of Rest of the Providers amount that were not selected in that Provider slicer. All the dimension filter should work on the rest of the filters but not on the selected filter. Also, I have to show all the slicers so removing interaction is not helping. I have to write the DAX only. Any type of help would be very much appreciated. Thank you.597Views0likes3Commentscalculate market share by year on a line chart
Hello All, I am having some issue to plot a graph of market share per year. I have the following data model: I am trying to represent the following graph: For the bar, it is a simple count formula. And the line shart should be the market share. However, it seems like my formula is not working because when no filters are applied, the line should be at 100 percent for each year and not like on the graph above. Here is my dax for the makert share: Market Share = VAR totalIv = CALCULATE(COUNT('Main Table original'[TVA])) VAR totalMarket = CALCULATE(COUNT('Main Table original'[TVA]), ALLEXCEPT('Main Table original', 'Main Table original'[Year])) Return DIVIDE(totalIv, totalMarket,0) How can I fix my formula to have the line at 100 percent when no filters are applied? ThanksSolved1KViews0likes1CommentIssues with level of detail calculation using a relationship model
I have 2 tables related. Table A (Maestro de partes) is the dimensional table, where each SKU code (NOPARTE) and brand group (CodMarca) is located. Table B (Liq 3M) is the fact table, stores the transacction at the SKU and date level from each import process in the last 3 months. I need to calculate the sum of the import costs over the FOB factory price at the brand group level. I also need this value to remain the same whether I disaggregate it per SKU or brand group. Here is the formula I'm using considering the filters I need for this calculation: Factor de importacion = CALCULATE( ([Total costos de importacion]/SUM('Liq 3M'[FOB unit liquid]) + 1), FILTER( 'Liq 3M', 'Liq 3M'[Via transporte] = 2 && 'Liq 3M'[Datediff aplicacion] > 0 && 'Liq 3M'[Datediff aplicacion] < 4 ), ALLEXCEPT( 'Maestro Partes', 'Maestro Partes'[CodMarca] ) ) https://1drv.ms/u/s!Ar7k80093sB_gckbSsUJKl9osviTWw?e=VfMKnh This is what I get: This is what I need: Any help will be appreciated!720Views0likes2CommentsIs there a DAX function similar to ALLEXCEPT that removes just a single filter and keeps the others?
Hi. I have this "simple" measure that calculates a sum of the column "Value" filtered by the slices values I give (FilterColumn1-N) plus a last filter in the measure DAX code (Data[Year] = Data[Data_MaxYear] - 1). (preudo code to descibe my question ...) Measure1 = CALCULATE(SUM(Data[Value]), FILTER(ALLEXCEPT(Data, Data[FilterColumn1], Data[FilterColumn2], ... , Data[FilterColumnN] ), Data[Year] = Data[Data_MaxYear] - 1)) This works, but is not ideal as I have to describe ALL the filter columns I will accept (FilterColumn1-N). And there are many "external" slicers and visuals that filter many columns in my PBI report. What I really need is a similar DAX function like ALLEXCEPT that just removes ONE filter column, but keep all the others. It seems like a logical DAX function, but I could not find it. Can anybody help me here? Thanks, LarsSolved7.8KViews0likes6CommentsHow to 'lock' a value in when using a Table visual
In my data, I have three Departments - New, Used, and Other. For Other, I need 80% of its Sales Income to be added to New's Sales Income (= New Blended Income), and 20% of its Sales Income to be added to Used's Sales Income (= Used Blended Income). I am wanting to present a 2x2 table: Blended Sales Income by Department, with only New and Used departments showing. All attempts to do this filter out the Other component in the New and Used rows. How can I effectively 'lock' the Other component in so that it is not removed by other filtering? I trust it has something to do with KEEPFILTERS, ALLEXCEPT or the like, but can't quite get it working. Thank you for your assistance711Views0likes1CommentREMOVEFILTERS/ALLEXCEPT not removing page level and report level filters
Hi, I have a measure (2 variants) as below to calculate the sum of a column for all calendar periods. Measure = CALCULATE( SUM('FACT ATS'[Planned Quantity Basic Units]), ALLEXCEPT('DIM Bega Calendar', 'DIM Bega Calendar'[Fiscal Period])) Measure = CALCULATE( SUM('FACT ATS'[Planned Quantity Basic Units]), REMOVEFILTERS('DIM Bega Calendar'[REL MTD/LM/NM/MTD YAGO/LM YAGO])) And I have a page level filter applied to the [REL MTD/LM/NM/MTD YAGO/LM YAGO] column of the calendar table to select the current period (202309). And I'm trying to display a table with the sum for all periods. However, the measure below is not removing the period filter and shows data only for the current period. What am I doing wrong here?664Views0likes1CommentPercentage of total (context and model)
Hi, I am creating a measure to calculate a "% of total" taking in the context the date field, but it only works if the date field is in the same table as the other values, i.e., when I try to use the date field from my DimCalendar it won't work. What am I doing wrong? Is it the modelling or the DAX? PBIX file avaliable in my OneDrive here. This works: % of year total = VAR amount = [Expenses] VAR TOT = CALCULATE( [Expenses], ALLEXCEPT(English, English[Year]) // English[Year] is a redundant calc col ) RETURN IF( SELECTEDVALUE(English[Year], "-") <> "-", DIVIDE (amount , TOT, "Error"), "Select a year" ) This doesn't: % of year total = VAR amount = [Expenses] VAR TOT = CALCULATE( [Expenses], ALLEXCEPT(DimCalendar, DimCalendar[Year]) // This won't work ) RETURN IF( SELECTEDVALUE(English[Year], "-") <> "-", DIVIDE (amount , TOT, "Error"), "Select a year" ) Thanks in advance for any tip.Solved870Views0likes2Comments