condition
13 TopicsSum only Values where another Column has Data
Harder than it looks: I have this simple table like below: I want to calculate how we're performing based on the goal in a Card. So I need to Sum only the goal values where the Gross Adds column is not blank(GAs are in the past and Goals are for the whole month). In theory this should work, but it puts a total for all the months previous rather than what is selected in the slicer. What's strange is if I replace [GAGoal] with [Gross Adds] in the measure below it correctly adds up the Gross Adds for the current month selected in the slicer. GoalTotalCurrent = VAR LastDaySelection = LASTNONBLANK ( 'Calendar'[Calendar Date], [Gross Adds] ) VAR CurrentRange = DATESBETWEEN ( 'Calendar'[Calendar Date], MIN ('Calendar'[Calendar Date] ), LastDaySelection ) RETURN IF ( LastDaySelection >= MIN ( 'Calendar'[Calendar Date]),CALCULATE ( [GAGoal], CurrentRange )) I've tried things like this, but it results in blank: SumGoals = IF(SUMX('Subscriber Activity',[Gross Adds])<>Blank(),SUMX('Subscriber Activity',[GAGoal])) So it shouldn't sum 1/8,1/9,or1/10 Date Goal Gross Adds 1/1/2025 5 6 1/2/2025 7 5 1/3/2025 8 7 1/4/2025 7 7 1/5/2025 4 3 1/6/2025 3 2 1/7/2025 2 1 1/8/2025 5 1/9/2025 5 1/10/2025 52.9KViews0likes16CommentsCalculated column based on lookup table returns empty
I'm trying to calculate for every contract in a dataset with contracts whether or not a specific budget applies or not. This budget I need to detract from my overall figure, so I need to have it on a contract to contract basis. I have queried a simple lookup table where I have all the relevant filter columns (product, model, duration, ...) and how high the specific budget is for these conditions. I want to calculate a column with for each contract the applied budget. I'll enclose my current DAX lines for calculating this column, and it does not give me syntax errors, but the resulting column is completely empty. My main table is 'Retail+Fleet' and 'Special actions' is the small lookup table with the conditions and the [Budget action] column with the size of the specific budget. I've also included a simplified version of the two tables, where the green column indicates what I expected the resulting column to look like, but that at the moment is completely empty (not even showing null or 0). Does anyone have an idea where I'm making a mistake? SpecialAction = /* Use if lookup doesn't bring anything back - this is for easiness just set to 0 */ VAR DefaultAction = 0 /* Product Class (to filter on PL) */ VAR ProductPL = 'Retail+Fleet'[Product Class] /* New Car */ VAR NewCar = 'Retail+Fleet'[New/Used car] /* Duration */ VAR Duration = 'Retail+Fleet'[Contract duration] /* Calculation Date */ VAR CalculationDate = 'Retail+Fleet'[Calculation date] /* CMIS Brand */ VAR CMISBrand = 'Retail+Fleet'[CMIS Brand] /* Model */ VAR CarModel = 'Retail+Fleet'[Model] /** Filter all contracts to see whether they fall within the specific conditions, and check whether the creation date falls within the to and from date range. The BLANK() value ensures that for the lines where the Car Model or the Duration is not filled in, the filter option is not stopped. **/ RETURN CALCULATE(FIRSTNONBLANK('Special actions'[Budget action],1), FILTER( 'Special actions', 'Special actions'[Product Class] = ProductPL && CalculationDate >= 'Special actions'[Date From] && CalculationDate <= 'Special actions'[Date To] && 'Special actions'[VN - VO] = NewCar && ('Special actions'[Duration] <= Duration || 'Special actions'[Duration] = BLANK()) && 'Special actions'[CMIS Brand] = CMISBrand && ('Special actions'[Model] = CarModel || 'Special actions'[Model] = BLANK()) )) Lookup Table ('Special actions') Product Class CMIS Brand Model Duration Date From Date To VN - VO Budget action PL Brand 1 24 1/1/24 31/1/24 VN 800 PL Brand 1 36 1/1/24 31/1/24 VN 1000 PL Brand 1 48 1/1/24 31/1/24 VN 1000 PL Brand 1 Model 1 48 1/1/24 31/1/24 VN 1500 PL Brand 2 Model 2 48 1/1/24 31/1/24 VN 600 PL Brand 3 Model 3 48 1/1/24 31/1/24 VN 600 Main Table ('Retail+Fleet') Product Class CMIS Brand Model Contract Duration Calculation date ... New/Used car SpecialAction AC Brand 1 Model 6 36 20/12/23 ... VN CC Brand 1 Model 40 24 30/12/23 ... VN OL Brand 1 Model 1 60 3/1/24 ... VN PL Brand 2 Model 2 48 5/1/24 ... VN 600 PL Brand 3 Model 4 48 12/1/24 ... VN PL Brand 1 Model 2 60 19/1/24 ... VO PL Brand 1 Model 1 24 30/1/24 ... VN 1500 PL Brand 1 Model 3 36 2/2/24 ... VN PL Brand 2 Model 3 30 18/2/24 ... VO PL Brand 3 Model 2 72 1/3/24 ... VNSolved658Views0likes2Commentscount rows on condition only for last date
Hi, I'm beginner in DAX. I've got a dataset like product, date, completed (a boolean value True/false), amount. I need to get the count of not completed rows where completed is false only for the last date by products. product, date, completed product1, 2023-12-01, false product2, 2023-12-01, false product3, 2023-12-01, true product4, 2023-12-01, false product3, 2023-12-02, true product3, 2023-12-03, true product2, 2023-12-03, false product4, 2023-12-04, true product3, 2023-12-04, false product3, 2023-12-05, false At 2023-12-05 (or after if no more data are added) I have product1, 2023-12-01, false product2, 2023-12-03, false product3, 2023-12-05, false product4, 2023-12-04, true My goal is to have a count of the completed_0 and completed_1. something like : count_completed = 1 and count_not_completed = 3. And when visualising by product, I like to have product1 : 1 not completed, 0 completed product2 : 1 not completed, 0 completed product3: 1 not completed, 0 completed product4 : 0 not completed, 1 completed When changing the global filter on date to go back in time, the "last date" should change the results according to the selection. I tried many approach using CALCULATE, LASTNONBLANKVALUE ... without result. Is a DAX approach is possible to answer this question ? what measure should I use to get the result I need ? Thanks for your help. Stéphane742Views0likes3CommentsGet earliest date by condition
Jolly Day, I am needing to create a measure to get the earliest date by Item Code. I am needing only one result for item code filtered by the earliest date. I tried using the filter on the visual to get the earliest date but my results go wonky so I am needing to do this in a measure. What I am currently getting. What I am needing Item Code WO_DueDate 00-200463 12/16/2022 Many thanks in advance!! 🙂Solved1.1KViews0likes2CommentsIF between DATEs return a TEXT values, how?
Hello community I am having the below issue: DAX comparison operations do not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values. I want to create a new column that checks if something (Clearing Date) happened between a period of 2 dates (Start reporting & End Reporting), in case of True return a text column with the responsible HUB and if false just type "Non Scope" HUB_Scope = IF ( T_[Clearing Date] >= RELATED ( T_Mapping[Start Reporting] ) & T_[Clearing Date] <= RELATED ( T__Mapping[End Reporting] ), RELATED ( T_Mapping[HUB_SCOPE] ), "NON SCOPE" ) Clearing Date. Start Reporting and End Reporting are Dates but HUB_Scope isnt. How can I can I make work the above formula ?? ThanksSolved1.4KViews0likes2CommentsPrevious month sales
Hi All, Previously thanks for the help, I have calculated previous month sum of values with using formula as below (Which is working fine ) : Previous Month = CALCULATE(SUM(data[data_A]),DATEADD(Dates[Date_2022],-1,MONTH) ) But now I want to calculate same previous month value but in this formula I have to use Filter-condition and I am getting blank values please find the below used formula : Previous month = CALCULATE(SUM(TableA[A]),FILTER(TableA,TableA[Value] = "EW"),DATEADD(Dates[Date_2022],-1,MONTH)) Please help me on this. Thanks ShipraSolved5KViews0likes4CommentsConditional Grouped SUM
Hello everyone, I am having trouble to sum a column by ticket ID but the ticket_ID must follow a rule. Ticket_id Product Product_Type Amount 1 A 0 10 1 B 1 5 1 C 0 10 2 A 0 10 2 C 0 10 3 B 1 5 4 B 1 5 4 C 0 10 I want to sum the total sales, of tickets that have at least a Product_type = 1. In the example above, the result should sum the total amount of tickets 1, 3 and 4 (a total of 45) because they have at least one product of type 1.Solved1.9KViews0likes5CommentsDAX Count under condition
Hey everyone, I have a DAX question for you. I have a data set that contains settled income of people on benefits. This income is recorded monthly by date. To see which people have received new income, I would like to make a chart in which you can see per month for how many people (unique) income has been settled. PLEASE NOTE that no income has been settled in the past 3 months. My dataset contains 3 columns: 1) ID (unique personal number). 2) DATE (Start date of settled earnings). 3) KIND (Type of income). I already have a calendar table, so I think I could achieve this with a DAX calculation. Who can and wants to help me? My experience with DAX is limited.Solved2.3KViews0likes8CommentsTOP N with condition on another measure
Hello Guys, I need your help, because I a have a fact table like this : I need to identify the product with the best average "Note", but only with products sold over to 50 units (sum of quantity). With the summarize/addcolumns, it's easy to retrieve for each product the both information : "average note" & "total quantity": As, you can see, the TOP1 Product, with the best average note AND with more of 50 units sold is Product C. Please, can you help me to find the correct formula to apply the top 1 on the "Summarize table" but with the filter on the "Total Quantity" (or another method...) ? For information, I have a fact table with a lot of dimension (date, product, region, Supplier etc...) and the formula need to work with all slicer in the report. Thanks in advance.Solved1.7KViews0likes2Comments