complex dax
5 TopicsDax logic not working
Hello again, its been a long month i am tring to find the problem in my code but i have no idea of whats going on. If anyone can help me with this it would be so good. I have two dashboards, both have the same code, the thing is, one is working with an excel file as source and the other has an internal source, i dont know if thats the problem root but thats the only difference between them. The dashboards: not working (ControleDaProducaoMaisLeve&BALSendDistribui.pbix) using excel source Working well (Sum interval considering many filters11101.pbix) own source the logic is, the stock might be distribuited to the orders in a way that it priorizes the orders with the lowest value (number) and if the item in the order has a value bigger than the remmaing stock (after being distributed to the orders that the quantity needed is <= to the stock) then, this orders will not be considered and other order with the item will be tested.. Thankyou all.1.2KViews0likes6CommentsSum interval considering many filters
Hello everyone, I have been here a time ago to solve a problem within this same topic, the thing is, the solution was complete but i found out that one other thing was needed. I need the following dax code, not to consider all the order as "out", when the sum of items reach the total of stok available, but, i need to test others orders to see if the amount of the stok can be used still, axample: i have orders 333, 444 and 555 with the item bbb, with quantities 2, 30 and 5, the stok is 10 for this item, the actual code, tests the stok to the orders and the result is : available, ou, out; but i need the result to be: available, out, available.. of course, following the same logic of the earlier order num, only inside of the range date i select. When i select the date 01/03/25 to 01/03/25, the only orders that have in this date are the in the example.. Measure = VAR _date = CALCULATE(MAX('Table date'[date]), ALLSELECTED('Table date')) VAR _quantity = CALCULATE( SUM('Table orders'[quantity]), FILTER( ALLSELECTED('Table orders'), [Item] = MAX('Table orders'[Item]) && [date] <= MAX('Table orders'[date]) && [Order num] <= MAX('Table orders'[Order num]) -- Considera o número do pedido ) ) VAR _stock = CALCULATE( SUM('Table stock'[quantity]), FILTER( ALL('Table stock'), [item] = MAX('Table orders'[Item]) ) ) VAR _result = IF(_quantity <= _stock, "available", "out") RETURN IF(ISBLANK(_quantity), BLANK(), _result) Thankyou a lot allready!Solved1.2KViews0likes6CommentsHow to get number of rows in a table based on a single column used in two different types?
Hi all, Need one quick help here, In my data, I have kind of a Parent-Child like structure in my fact table in a single column, but I have created another table which defines parent child relationship as below: Now, in my fact table, I have only index column and I have two text columns to compare the actual and expected values and define them as TRUE or FALSE. So, fact table is like Index --- Actual --- Expected 18 19 ---- Yes ----- Yes 20 ----- Yes ----- No 21 ----- No ----- No So, for index 19,20,21, I can easily say that 19 and 21 is True and 20 is False. But, for 18 (which is parent for 19,20,21), I need to see if all the child indexes the true, then only I will be able to mark it as true. For this, I am trying an approach where I am getting the count of child indexes first (which I am able to do using DAX and parent child relation table) and then get the count of True rows for those child (this is where I need help), and if both these counts are equal then I am marking 18 as True else False. Can you please help me with DAX where I can get the count of Trues for all the child under any given parent? Regards716Views0likes3CommentsSum column B by Column A IF the sum of column C by Column A <> 0
OK, I know that subject may look like garbage, but hear me out. One of the primary record types for my business is Jobs. Each Job can have multiple Transactions associated with it. Each Transaction will have a dollar value for Amount and may have a dollar value for Retainage. Where things get complicated is that the same TransactionID may be associated with the job multiple times. (Yes, I know the optimal course would be to find what is causing the multiple iterations and filter down to one but all of my support resources are have yet to help me with that) The goal is: When total Amount for a Job is not equal to 0 (it may be positive or negative) then Take the Maximum Retainage value for each Transaction associated with that Job and add them together so that We arrive at a Total Sum of all Maximum Retainage values for all Jobs where the total Amount does not equal 0. I know how I can get the sum of the Amounts per Job. And I know how I can get the Max value of Retainage for a transaction. What I need help with is putting that together so I am adding the max retainage values for all transactions associated wtih a job where the total value of the job <> 0. I have an exmaple of how the process should work below.Solved840Views0likes3CommentsSemi-additive max date by account and category
Hi all, I am working with data which captures stages of clients from prospect to customer. each stage records a different potential contract value of the customer, and the latest date for particular customer holds the most accurate value I want to be able to extract by date/month etc. Link to dummy data in PBI for context: https://1drv.ms/u/s!AoIOEd5cDuqQuRmioxhdXlsHT3pX?e=72Nwue This is the sample data screenshot and desired output (count total max value of opp based on the last date the opp has been modified and so on for the count of opps based on stage and forecast category) I tried using Semi-Additive Measure to calculate sum for Last date of the day, but it only sums max opp_1 and max_date - It does not add multiple opp values to create pipeline of prospects&customers based on any given time period (month date) - see below Any help would be appreciated. 🙂Solved2KViews0likes7Comments