sumx()
12 TopicsUnexpected behavior of calculated column
Hi community, we have a simple data model with tables order, order item and item. For statistical purposes we want to have the quantity sold for the item. If I add calculated column to article it works. If I then filter the visual by date from the order, that column is not filtered. Could anyone help to fix the problem, please? DAX: Verkaufte Menge = SUMX(RELATEDTABLE(tAuftragPosition), tAuftragPosition[fAnzahl]) Bye MagnusSolved550Views0likes2CommentsDifferent Measure for Row Totals
Hi all, I have a measure that removes filters from an another measure using the all function on two dimensions, account, and account group. The measure is like so. ALL Last Year = VAR Calc = IF ( ISBLANK ( CALCULATE([Selected Measure Total]+[Selected Measure Last Year Total], ALLEXCEPT('Date', 'Date'[Year]) ) ), BLANK (), CALCULATE ( [Selected Measure Last Year Total], ALL ( 'Account'[Account] ), ALL ( 'Account Group'[Account Group] ) ) ) Return Calc This works as intended on the level below accounts, sub accounts, and allows me to see if there was any "selected measure total" for last year outside of that account/account group for that sub account. But when adding this measure to a matrix it obviously totals it incorrectly for me (correctly as per the logic) for Accounts and Account Groups. I would like for the the totals for Accounts and Account groups to be the totals of all the subaccounts nested inside of them. I followed the advice of this thread https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376 to use HASONEFILTER to alter the result if subaccount <> have one filter, but my problem is I cannot get the alternate formula for when it does not have a filter, to work as intended. The most logical to me is Return IF ( HASONEFILTER ( SubAccount[SubAccount] ), Calc, SUMX ( SubAccount, Calc ) ) But this multiplies the original incorrect (correct) value by the number of subaccounts in total selected. I have tried using combinations of keepfilters, summarize, calculatetable etc but can't seem to crack it. Any help would be appreciated, thanks.Solved545Views0likes1CommentDAX with double tables
Hello everyone, i have a MOM consumption data, I want to choose the month I want to analyse and the period "X" for which I want to compare ( last 30/60/90 days) "Y". All Dax works fine however if I want to get the value of only the new items for "X" compared to "Y", it compares it to the data in all the other months. I'm ready to clarify if needed. Thank you in advance.536Views0likes2CommentsUnable to use AddColumns Summarize with Calculated Dimension
I am working with both forecasts and actuals, and I would like to create a version which is called "Forecast + Actuals" which is a combination of actuals and the forecast values which is after the last date of actuals. I know you can do this via a measure like if selected value = "Forecast + Actuals" then return calculate measure, but I would prefer to do it in one measure to reduce the complexity of my measure tree. Here is an example data set. Date Version Value 31-Oct Forecast 100 30-Sep Forecast 150 30-Sep Actual 120 31-Aug Actual 100 Here is the Version Dimension table. "Forecast + Actuals" doesn't exist in my fact table, but can be derived from the fact table through a combination of Forecast and Actuals. Version Dimension Table Forecast Actuals Forecast + Actuals I would like a measure which would populate the following: Version 8/31 9/30 10/31 Forecast 150 100 Actuals 100 120 Forecast + Actuals 100 120 100 I was trying to accomplish it like this via this measure: DataSum = VAR MaxActualsDate = CALCULATE ( MAX ( FactTable[Date], Version = "Actuals" ) ) VAR SummaryData = ADDCOLUMNS ( SUMMARIZE ( 'FactTable', 'Date'[Date], Versions[Version] ), // this is the core table "@SourceValue", CALCULATE ( SUM ( FactTable[Value] ) ) ) RETURN IF ( SELECTEDVALUE ( Versions[Version] ) = "Current Forecast + Actuals", CALCULATE ( SUMX ( SummaryData, [@SourceValue] ), [Version] = "Actuals" ) + CALCULATE ( SUMX ( SummaryData, [@SourceValue] ), [Version] = "Forecast", Date[Date] > MaxActualsDate ), SUMX ( SummaryData, [@SourceValue] ) ) I didn't find any success here - so then I decided to modify the variable table by unioning the "Forecast + Actuals" into the SummaryData variable table. When i look at this in DAX studio, the table does have "Forecast + Actuals" with values, however, I am unable to bring this into a visual. DataSum = var MaxActualsDate = calculate( max(FactTable[Date],Version="Actuals") Var SummaryData = ADDCOLUMNS ( TREATAS ( UNION ( SUMMARIZE ( 'FactTable', 'Date'[Date], Versions[Version] ), // this is the core table ADDCOLUMNS ( SUMMARIZE ( FactTable', 'Date'[Date], Versions[Version] ), "Version", "Current Forecast + Actuals" // this is where i'm trying to add the "fake data series" ) ), 'Date'[Date], Versions[Version] ), "@SourceValue", IF ( [Version] = "Current Forecast + Actuals", CALCULATE ( SUM ( FactTable[Value] ), ALL ( Versions ), Versions[Version] = "Actuals" ), CALCULATE ( SUM (FactTable[Value]) ) ) Return Sumx ( SummaryData, [@SourceValue])Solved497Views0likes1CommentHelp w SumX using calculated column (multiplication)
Hi all I have a data model which Im using to calculate costs in an excel data model. Each employee is assigned a % they are on a scrum team. I have the daily rate for each employee and multiply that by % to get the adjusted daily rate. When I sum this column implicitly or explicitly with a measure I am getting the incorrect total for each scrum team. I am assuming I need to use SumX to get the correct total per scrum team however I cannot get it to work. The adjusted daily rate column multiplies % by daily rate. I need to sum this column to show all the scrum team rates by team and employee. The subtotal rows for each scrum team are not displaying correctly but the employee rows are correct. AdjDailyRate:=SUMX(Scrum__W_Rates,SUM(Scrum__Rates[Adjusted Daily Rate])) Example: the highlighted cell should equal 14,996.25. Thank youSolved972Views0likes3CommentsHelp! How to sum up minimums?
Hey guys, I'm trying to sum up the minimums I got from this formula: min(balanced order qty, physically available). I tried sumx(table, min(balanced order qty, physically available)) but didn't work. Highlight above is what I expect to get. Thank you so much!!!528Views0likes1CommentWriting Measure that Returns Customer Specific Revenue based on Customer Specific Multiplier
Hello, I am attempting to write a measure that examines the customer name before returning a customer specific revenue given a customer specific multiplier multiplied by the amount of items sold. For example, if the customer is customer 1 in this case, then we would take the customer 1 specific multiplier and multiply it by the number of items sold to get the customer 1 specific revenue (if customer = customer 1, then customer 1 multiplier * # of items sold = customer 1 revenue). However, the measure does need to be able to store multiple (up to 30) different customer specific multipliers and in turn know when to use each one based on filtering from a slicer that allows you to choose between customers. I have written the following measure that only appears to work for customer 1 and not the following customers in this example. The numbers 5, 10, and 15 are placeholder customer specific multipliers. Measure1 = SUMX (‘Table’, IF(‘Table’[Customer]= “Customer 1”, ‘Table’[Items Sold]*5, IF((‘Table’[Customer]= “Customer 2”, ‘Table’[Items Sold]*10, IF((‘Table’[Customer]= “Customer 3”, ‘Table’[Items Sold]*15 ….. Here is another measure I’ve attempted but have had no luck with: Measure2 = SWITCH( TRUE(), ‘Table’[Customer] = “Customer 1”, ‘Table’[Items Sold]*5, ‘Table’[Customer] = “Customer 2”, ‘Table’[Items Sold]*10, ‘Table’[Customer] = “Customer 3”, ‘Table’[Items Sold]*15, )) Any feedback and help are much appreciated.1KViews0likes4CommentsSumx function isn't working
Hi there, please help me. my sumx function isnt working for a total qty measure i calculated. I have my Qty measure where I am replacing my empty rows with the previous values as such final Qty = VAR CurrentValue = SUM ( data[qty]) VAR PreviousValue = if( sum(data[qty]) = BLANK(), CALCULATE( sum(data[qty]), date[date_dt] = MAX(date[date_dt])-1, )) RETURN if( max(date[date_dt]) =max(date[date_dt]) , CurrentValue + PreviousValue, CurrentValue ) When I put this total on my table view, I dont get the iterative total by the dates as I would like to see. It is giving me the total qty logic as if I was jusr doing a sum(qty). Iterative Qty = sumx(values(date[date_dt]), [final Qty]) (this should add up all the values on the views itself but when I look at it, the rows are correct but the total is still wrong. I had to export it to excel and noticed its not working) Any other way to add my iterative values for my view?Solved1.9KViews0likes3CommentsFilter virtual table to keep most recent dates by user and goal type
If I have users Jeff and Steve, and each can update there different goal types (products sold & cold calls).. I'd like a measure that iterates a virtual table and returns the most recent (max date) goal amount set (by name and goal type). See example below, and highlighted*** rows that result in the most recent goals to keep. Thank you in advance. my table looks like this: Name. Goal. Date set Amt jeff. Prod sold. 1/1/2020. 10 jeff. Prod sold. 2/3/2020. 15*** steve. Cold calls. 2/15/2020. 6 Steve. Product sold. 2/7/2020 9*** steve. Cold calls. 3/12/202. 8***Solved1KViews0likes2CommentsExcel to Dax, using sumifs formula
I'm in process of converting an excel report to Power BI. This includes matching the output of a column that has a SUMIFS formula included in the conditional statement. The columns are exactly the same in both reports, but when creating the calculated column in Power BI, I'm finding it difficult to emulate what is done with the Excel formula Excel formula: =IF([@[Shipped/CSO]]="SHIPPED",0,IF([@SOType]="SO",SUMIFS([QTY],[InvoiceDate],"="&"",[Index],"<"&[@Index],[Branch],[@Branch],[Part],[@Part]),0)) Dax formula : IF([Shipped/CSO] = "SHIPPED",0,IF(Sales[SOType] = "SO",SUMX(FILTER(Sales,Sales[InvoiceDate]=EARLIER(Sales[InvoiceDate],1)&& Sales[Branch]=EARLIER(Sales[Branch],1) && Sales[Part] = EARLIER(Sales[Part],1)),Sales[QTY]),0)) I am willing to provide an example of the table information, but the Sales table has exactly the same information. Thanks for the help!Solved1.2KViews0likes2Comments