totals
26 TopicsTotals by second level of a matrix's column
Hello all, I have a matrix like this: ColField ColValue1 ColValue2 ColValue3 TOTAL RowFiled Open1 Open 2 Open1 Open 2 Open1 Open 2 Open1 Open 2 RowValue1 1 3 6 4 3 7 10 RowValue2 2 4 6 2 1 10 5 RowValue3 5 2 2 2 2 9 13 I'm asked to include in it a Totals column at he end like in the example in red, that is, totals by the second level of columns in the matrix, which are always the same since it's from an aux table: OpenedInterval = DATATABLE( "Interval", STRING, { {"Open1"}, {"Open2"} } ) Thanks a lot in advanceSolved1.1KViews0likes5CommentsDifference measure wrong, but only for 1 row
Hello, I am using a measure to calulate "Goal Difference". The measure DAX formula = SUM('TableX' [Goals By Region] - SUM('ActionsTable' [SalesOrderMade]. The Goals By Region is a static table shown in Chart 2 below. The ActionsTable is a dynamic cource I am pulling in from a dataserver, thus as more oders are made, we would get closer to the goals. The proble is with the row labeled West becasue Achieved YTD - Goals should be a Goal Difference of 4,338 (not 18,838). Any tips on why the other rows are correct, but not this one?Solved1.2KViews0likes5CommentsUnable to get the YTD number for a given total
I'm working with a trial balance which gives output in YTD format i.e. it rolls up the numbers from Jan to whichever month you are downloading the data for. Now I want to work our the amounts for the month for which I have written the below dax Below is my Base data named "OS TB_Input" which is granular to the GL and Cost Centre and I have a Dimention table for both GL and Cost centre separately and mapped to this Fact table along with a Calendar table mapped to the Month Column. Amount is the column with YTD numbers for each particular month for that GL/ Cost Centre. "[Trial Balance]" just sums up the amount column which is YTD numbers. Trial Balance = SUM('OS TB_Input'[Amount]) Monthly is a measure created to find the monthly values Monthly = VAR PrevMonth = CALCULATE( [Trial Balance], PREVIOUSMONTH('Calendar'[Date]), COA_Grouping[P&L/ BS] = "P&L" ) VAR CurrentMonth = CALCULATE( [Trial Balance], COA_Grouping[P&L/ BS] = "P&L" ) RETURN IF( ISBLANK(CurrentMonth), BLANK(), [Trial Balance]- PrevMonth ) Although this gives the monthly numbers correctly but it messes up the totals as what I expect in the total yearly column is the sum of all the Months whereas it's showing up a much different number. Pl help to correct the totals and also if someone could suggest how to improve the dax, that would be of great help.Solved888Views0likes3CommentsTotal Is Correct but row is not when using ALL
Biggest puzzler yet: I have this measure called [%Need]. The sum total of these percentages needs to be 1 in order to compute correctly. However, it's not, so in order to correct it I need to do a formula like: [%Need]/Sum [%Need] *1. So in order to get sum portion I did: CALCULATE(SUMX(VALUES('Calendar'[calendar date]),[%Need]),ALL('Calendar'[CalendarDate])) This puts 1(I checked it out to 15 0s 1.00000000000000 in each row instead of the correct amount which is 1.0147. 1.0147 however appears in the Total at the bottom. I need 1.0147 in each row so I can have it divided by [%Need]. This probably doesn't need to be included, but just in case the [%Need] measure is: IF([CALendarDATE]>LASTNONBLANK ( 'Calendar'[Calendar Date], [Gross Adds]),[PYGA]/([PYALLGAs]-[GAsLyMAXDateAll]),Blank()) Any idea how to get the correct total in each row?656Views0likes2Commentswrong measure total including if statement
I have a table "Komm", which looks like following. Right now my Total of "Factor final" is wrong and I cant wrap my head arount how to do it correctly: Name Product Description Amount Unit Factor (comes from another table called "Factors") Factor final Tom A Apple 2 ST 3 6 Jack B Rope 30 M 6 6 Jack C Apple 5 ST 3 15 Cole D Pumpkin 8 KG 4 4 Basically what I want is, that if in my visual I click on the name of the Person, for example Jack he sums up 6 + 15 = 21. So the result is 21. When Jack is not selected it should show the whole sum (over all lines). Additionally to that I have different calculations depending on the Unit, so for "M", "GA", "L" and "KG" he should calculate the Factor * 1, for all the other units the Factor should be multiplied with the Amount. What I tried is following: Faktor final = VAR collecting = SELECTEDVALUE(Komm[Unit]) RETURN SWITCH(TRUE(), collecting= "M" || collecting="GA" || collecting="L" || collecting="KG", SUMX('Factors', 'Factors'[Factor]*1), SUMX(Komm, Komm[Amount]* RELATED('Factors'[Factor]))) Hope somebody can help me 🙂Solved3.8KViews0likes22CommentsDistinctcount + sumx throws strange results
Hi All, I have been breaking my head around this one, hope somebody can help me understand. I have an issue with a Dax formula, I hope you don't mind I added an example in Excel PowerPivot rather than PBI... Attached file contains data sample, 1 measure and a pivot table. Result is as follows: Can somebody explain me the 122...I would totally expect 92 there...I am aware of how SUMX works, I am aware that totals are not always a sum of the above, and I feel like I am missing the obvious here, but I think I am in somewhat of a rabbit whole here 😉 Who can help me undertand. Book1.xlsx For the grand total, I would expect that VALUES(PropertyID) iterates over Property 1, counts 61 distinct dates...then Property 2, counts 31 disntinct dates, then sums them to 92... Thx JanSolved831Views0likes2CommentsCalculate in measure at column won't filter other objects
Hi! I placed this measure in "values" on a Matrix: measure = CALCULATE(sum(Fact[Totalsum]),Fact[type] = "D") But when i select anything within this matrix it will filter all objects from the model excluding Fact[type] = "D" and showing the absolute total (Measure total is selected) I also tried using SumX but didn't work: measure = SUMX(FILTER(Fact,Fact[type] = "D"),Fact[Totalsum]) Why could this be?757Views0likes2CommentsDifferent 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.Solved545Views0likes1CommentIncorrect Measure Total on Matrix Visual
Hi, I have the following the following report page with a date slicer and a table. - The date slicer comes from a date table that DOES NOT have a relationship with my facts table. -The "Max" date in the date slicer is used for the "Calculation" measure (DAX below), which essentially is a SWITCH Function that handles the following conditions. 1) If "End Date" <= "Max" date in the date slicer then return the full value of "Dollars" 2) If "Start Date" = "Max" date in the date slicer then return daily rate of "Dollars" (Dollars / (End Date - Start Date) 3) If "End Date" > "Max" date in the date slicer then return the daily rate * ("Max" date in the date slicer - Start Date) Calculation Dax SWITCH( TRUE(), MAX('Fact Table'[End Date]) <= MAX('3.dim_date_table'[Date]), SUM('Fact Table'[Dollars]), MAX('Fact Table'[Start Date]) = MAX('3.dim_date_table'[Date]), DIVIDE(SUM('Fact Table'[Dollars]),(DATEDIFF(MAX('Fact Table'[Start Date]),MAX('Fact Table'[End Date]),DAY)),0), MAX('Fact Table'[End Date]) > MAX('3.dim_date_table'[Date]), DIVIDE(SUM('Fact Table'[Dollars]),(DATEDIFF(MAX('Fact Table'[Start Date]),MAX('Fact Table'[End Date]),DAY)),0)*DATEDIFF(MAX('Fact Table'[Start Date]),MAX('3.dim_date_table'[Date])+1,DAY) , 0 ) On a row by row basis, everything appears to be working as expected. The only issue is that the total amount is not accuate. For example in the screenshot below, we see that the Calculation total is $5,934.01 when it should be $6,319.61 I suspect this is due to the lack of row context when referring to the "Max" start and "end" dates for the total calculations, so the max values of the entire dataset are used rather than calculating row by row. Here is a link to the pbix file: https://drive.google.com/drive/folders/1GjFTpaLMW-6vf36LFPpHR_IHuhtaAcPL?usp=sharing Please let me know if any additional information is needed. Any input is appreciated. Thanks!Solved836Views0likes3CommentsMeasure shows wrong total, does not take into account all Months
Hello Community, I created a Measure which forecast values for Months which currently do not have any Data. In a Matrix it shows the correct results for exisiting months(current value of a measure) and for months, where the Measure is currently blank. But the total is wrong. It still only show the total for the existing months. The measures are based on my facttable. The Fact table currently has data until end of August. There are no rows for Months after august. Also when i put the Measure as a Column in my Date Table, it only returns the results for months which are available in the Fact Table.384Views0likes1Comment