dax problem
7 Topicscant find the problem in code
Hi everybody This porblem is driving me crazy, i have two dashboards with the same dax codes, the thing is, in one it works properly, in the other it does not and i just can't find out why. the dashboards: the one with problem (ControleDaProducaoMaisLeve&BALSendDistribui.pbix) the working one (Sum interval considering many filters11101.pbix) The logic is, the stock might be distributed properly through the orders in a whay that it goes first to the oldest to the newest order, and if the order quantity is bigger than the left stock after distributed to the anterior, it will verify the next order and if the quantity os the remaing stock is enought to the order need, it will be used. see in image below: the marked in green is what it should be, i have 72 of this item in stock and it should be enought to the orders 111, 222, 444 and 555. Please anyone help me, i totaly can't find the problem, one works and the other just does not.. Thankyou all.1.2KViews0likes6CommentsGet the average of a column value based on total count of values in ID column
Hi, In a table i have column called "Object" which runs multiple times in a day and that runtime is captured in "StartTime" & "EndTime" columns, and the difference between the start and end time is captured in the "Duration" Column. Each object will be having multiple runid's which is captured in "RunID" column which is a unique value. For eg: Object AAA has two runid's called "111,222" and Object BBB has one runid called "333". Now i would like to get the average of each duration by count of that particular runid which is captured in "New Duration" column. For eg: The count of 111 runid is '10'. so for all those durations with runid 111 should be divided by the 10. The count of 222 runid is '6'. so for all those durations with runid 222 should be divided by the 6. The count of 333 runid is '8'. so for all those durations with runid 333 should be divided by the 8. Sample screenshot for above query: So since my Duration is "10" and total count of runid (111) is 10. So 10/10=1 that is my newduration.Similarly for all durations with runid's 111 should be divided bt 10. How to achieve this using DAX query?? I am connecting to this table in powerbi via SQL direct query mode. Thanks.Solved1.1KViews0likes2CommentsShow Current Week by default
Hi everyone, so im using current week filter and all weekNo. filter on left for year 2022,2021,2020 (same weeks) so that boss can see chose which ever weeks he like. Need: but he wants the current week to be showed by default. so if he opens this report he will see the current week sales for the year 2022,2021 and 2020 (same week) and use the all weekNo. filter to see the other weeks other than current. Problem: Problem is that the way i have used the current filter in dax does not allow me to use the other all weeks filter. please find below the dax code i have used for current week SemCourante = //Current Weeks if(year(now())&weeknum(now()-1) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante", if((year(now()))-1&weeknum(now()) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante-1", if((year(now()))-2&weeknum(now()) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante-2", if((year(now()))-3&weeknum(now()) = year(DMVBICalendarView1[Date])&weeknum(DMVBICalendarView1[Date],1),"Courrante-3")))) and please find below the weeknumbers, If any of you can solve this problem that will be a huge help. show me a way to merge weekno. and current week in the same code or column. so current week becomes default but if user selects any weekno. it shows the values as well. thanks in advance to this wonderful community.725Views0likes2CommentsSQL to DAX conversion
I am trying to get the equivalent logic in DAX for below SQL declare @date datetime declare @warehouse nvarchar(225) declare @province nvarchar(225) set @Transdate = '2021-09-18 00:00:00.000' set @province = 'BC' set @warehouse = 'BC-01' ----- THIS CTE RANKS THE ITEMS TO GET THE MOST RECENT category ----------- with main1 as ( SELECT * , ROW_NUMBER() OVER(Partition by itemid, warehouseid ORDER BY transdate DESC) AS rn FROM [EDW].[FACT].[InventoryBalancedet_2] dt WHERE province = @province and warehouseid = @warehouse and transdate <= @Transdate ), ------ THIS CTE RANKS amount of an item by warehouse ----------- main2 as ( select sum(Amount) as AMOUNT , ItemID ,warehouseid FROM [EDW].[FACT].[InventoryBalancedet_2] WHERE province = @province and warehouseid = @warehouse and transdate <= @Transdate group by ItemID , warehouseid ), ------------ COMBINING THE QUERIES TOGETHER -------------------- main3 as ( SELECT m2.AMOUNT, m2.warehouseid , m1.Category FROM main1 m1 inner join main2 m2 on m1.warehouseid = m2.warehouseid and m1.ItemID = m2.ItemID and m1.rn = 1 ) select sum(m3.total) ,m3.Category FROM main3 m3 group by m3.CategorySolved4.7KViews0likes10CommentsMy formula ends in division by zero error and I just don't know why
Dear community, I have a rather odd problem that I have been working on for the last two hours but still fail to understand where/what exactly the error is. Apparently, "A division by zero has been encountered". But the problem is that my denominator is a fixed value that is not zero. Is there maybe a bug in DAX that leads to this outcome? And if yes, does anyone know a work around for my issue? Here is my concrete case I am having the following table where the current formula for CTS is CTS = 1.2803*sum(Table1[Number Of Invoices]) As you can see, the 1.2803 is based on column Result which itself is the result of the value in column Numerator over the value of column Denominator (The values in column Denominator, Numerator and Result are always the same which I double checked by generating a data excerpt for Excel in which I confirmed that there are absolutely no zero values.). Accordingly, the formula for Result is Result = Table1[Numerator]/Table1[Denominator] I now wish to directly insert the Result value 1.2803 directly into the CTS formula so that it reads CTS = Table1[Result]*sum(Table1[Number Of Invoices]) However, when I do this, I get the error message The table is filtered but this should not be an issue for my calculations, right? So can anyone please explain to me where this mysterious division by zero is occuring?4.1KViews0likes6CommentsCalculo Semestres
Buenas Tardes Cordial Saludo Tengo una base de datos de la siguiente forma: Necesito calcular cuantós semestres trasncurren entre la columna cohorte y la columna graduado, para definir si el estudiante se graduo en el tiempo estipulado. Me gustaría si por favor alguno de ustedes sabe cómo hacer este cálculo, me explique la manera de realizarlo. Muchas gracias por la atención.1.8KViews0likes2Commentsdax issue
hi everyone , i have some dax issues , my requriments is when i click on that currency slicer is filter to the matrix table only first three row is not change in currency values . so am create one" parameter id" column also like (1,2,3,4,5...) example: i need to first three row values is " column =A "values , otherwise fourth to end row values given from " netvalue" measure value. (var netvalue =axb if paramter id=1 or 2 or 3 return 'TABLE B'[InputValueInEURO] values else return netvalue) am written the dax is: TabularView = var selectedCurrency = IF(ISBLANK(SELECTEDVALUE('table A'[CurrencyCode])), "EUR", SELECTEDVALUE('TABLE A'[CurrencyCode])) var netValue = (SUMX('TABLE B', 'TABLE B'[InputValueInEURO] * Lookupvalue('TABLE A'[EurRate], 'TABLE A'[CustCurrencyDate], 'TABLE B'[CustomYearMonth], 'TABLE A'[CurrencyCode], selectedCurrency))) return netValue pl sort me out973Views0likes1Comment