percentage difference
7 TopicsDynamic % Difference Dax when filtering on non consecutive years
Hi there, I have a matrix in power BI, items in rows, years in columns and a YOY% difference measure. I can;t show actual data, so here is an example in excel of what I'm doing: Problem is I'm not always comparing to previous year. Sometimes we may want to compare 2019 Vs 2022. This works in excel: Excel calculates the difference in the filtered period. However when I do this in Power BI, when I filter it returns the previous year % difference not filtered period. In power BI I am using a matrix like this: Fruit YoY% (from quick measures) code is: Fruit YoY% = IF( ISFILTERED('Date Table'[Date]), ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."), VAR __PREV_YEAR = CALCULATE( SUM('Fruit'[Value]), DATEADD('Date Table'[Date].[Date], -1, YEAR) ) RETURN DIVIDE(SUM(Fruit[Value]) - __PREV_YEAR, __PREV_YEAR) ) Which works for YoY, but when I filter, eg, 2020 Vs 2022, it still shows 2022 Vs 2021 % dif. When I use the below code, it works when two filters are on, but defaults to 2019 Vs 2022: Fruit Earlier = VAR earlieryear = calculate( min ('Date Table'[Year]), allselected ('Date Table')) return calculate ([Total Fruit Sum], all ('Date Table'), 'Date Table'[Year] = earlieryear) Fruit Later = VAR lateryear = calculate( max ('Date Table'[Year]), allselected ('Date Table')) return calculate ([Total Fruit Sum], all ('Date Table'), 'Date Table'[Year] = lateryear) fruit % dif = var lateryear = calculate (max('Date Table'[Year]), allselected ('Date Table')) var maxyear = max ('Date Table'[Year]) var earlier_ = [fruit Earlier] return if (lateryear = maxyear, divide ([fruit later]-earlier_ , earlier_)) Ideally, I'd need top level to be YoY%, (across all years if possible but 2022 Vs 2021 would be fine), then the slice the years to get the below: So ideally it would be: 1. YoY% difference (2022 Vs 2021, 2021 Vs 2020 etc) 2. Slicer two years (eg 2022 Vs 2020) 3. Filtered years % difference eg 2022 Bs 2020) 4. Remove slicers to return back to YoY% difference (2022 Vs 2021, 2021 Vs 2020 etc) Any help on what DAX I need to make this work would really help!693Views0likes0Comments% Variation
Hey all, I want to calculate the % variation of a stock, but I am having trouble to lock it's earliest and lastest value to perform my calculation. Stock MaxDate year-month Value A 7/31/2022 Jul-22 14 A 8/31/2022 Aug-22 15 A 9/30/2022 Sep-22 15 A 10/31/2022 Oct-22 12 A 11/30/2022 Nov-22 16 B 7/31/2022 Jul-22 74 B 8/31/2022 Aug-22 65 B 9/30/2022 Sep-22 64 B 10/31/2022 Oct-22 67 B 11/30/2022 Nov-22 80 C 7/31/2022 Jul-22 110 C 8/31/2022 Aug-22 105 C 9/30/2022 Sep-22 90 C 10/31/2022 Oct-22 110 C 11/30/2022 Nov-22 85 Besides this table, there is also a Calendar table that is connect by a Date column. For Stock A I always want to Initial Value to be = 14. Then, as the months go by I want to: August % = (15-14)/14 September = (15-14)/14 October = (12-14)/14 November = (16-14)/14 How can I do this? Thanks!Solved1.3KViews0likes7CommentsHow to show the percentage change of sales from the previous month instead of the cumulative percent
Hi I am a Junior BI Developer. This is training data i created to simulate what i am trying to do. Which is to show just the Monthly percentage change in sales for the current month. I have a solution but from my image below PowerBI keeps giving me the total percentage change highlighted in green. I want the final value in the Alt MoM Sales % or the MoM Sales % Column which is 33.33% highlighted in red. Formula Used is below: Total Sales = SUMX('Fruit Sales', 'Fruit Sales'[Sales]) /* This is for previous months sales */ Last PM Sales = CALCULATE([Total Sales], PREVIOUSMONTH('Fruit Sales'[Date])) MoM Sales = [Total Sales] - [Last PM Sales] MoM Sales % = DIVIDE([MoM Sales], [Last PM Sales]) /*An alternative formula to find the previous month's sales */ Alt PM Sales = CALCULATE([Total Sales], PARALLELPERIOD('Fruit Sales'[Date], -1, MONTH)) Alt MoM Sales = [Total Sales] - [Alt PM Sales] Alt MoM Sales % = DIVIDE([MoM Sales], [Alt PM Sales])Solved5.3KViews0likes4CommentsHow to deduct cents from a rate column and the multiply that value for a total volume in Power BI?
Hi Group, I’m new to Power BI and I’m trying to replicate from Tableau the below formula into Power BI. Can anyone please tell me how to create a measure in Power BI for the below formula? Formula in Tableau: Table Name: Bpay_Biller Columns: DR Chg Rate Debit Account Volume (0.88 - [DR Chg Rate]) * [Debit Account Volume] Thanks for your help ☺️!Solved837Views0likes2CommentsForecast Accuracy: Calculate the Category average based on percentages subcategories
Hello friends, I'm struggling with this issue for like a month, anybody could help me please? I have two tables: Forecast Table: Account Category Subcategory SubSubcategory Forecasted Value Actual Table: Account Category Subcategory SubSubcategory Actual Value I would like to calculate my forecast accuracy in two methods (like in the simplified table below) : - Weighted Average Accuracy (easy, I got this) - Non Weighted Average of the Subcategory Accuracies (in yellow) After this, I need to be able to filter the results by "Account" with a slicer on my dashboard. This will allow me to understand how well the Account has forcasted for each Category, Subcategory and the third is a KPI that kind of average the two. I think this could be done with some DAX VAR or GROUPBY but didn't manage to do make it right now.. Any ideas folks?Solved1.4KViews0likes1CommentHow to calculate percentage difference across columns in a matrix?
Questions Using DAX, how do you calculate the percentage difference across columns in a Power BI matrix? Can DAX do this without hardcoding the column value? Use Case For example, say, I want to create a matrix of Sum of Revenue against Week as Rows and Year as columns in a matrix table. See Example Data below. I want to compute percentage difference of Sum of Revenue by Year (column) for each Week (row). See Expected Result below. How could I compute that percentage difference without hardcoding Year? My data source always gives year-to-date (YTD) data for the last 3 years of data. And I am hoping to avoid having to update the hardcoded year when the new year roles over. See Background below if interested in seeing how this is done using a PivotTable in Excel. Example Data Week Year Revenue 1 2020 6800 2 2020 7300 3 2020 7350 1 2021 7260 2 2021 8300 3 2021 8360 1 2022 8300 2 2022 9100 3 2022 8900 Expected Result Week 2020 2021 2022 1 6.76% 14.33% 2 13.70% 9.64% 3 13.74% 6.46% Total 11.52% 9.95% Background I am an Excel user familiar with PivotTables. To do the same, I would pivot Sum of Revenue on Week as Rows and Year as Columns. Then change the field values of Sum of Revenue to Show Values As to % Difference From for Year as the base field and (previous) as the base item. I am trying to translate this logic in an Excel PivotTable to a Power BI matrix and am getting stuck. It appears that Power BI doesn't have the equivalent menu options. So I am guessing I have to use DAX to get this done. Excel PivotTable Menu Options Power BI Matrix Menu OptionsSolved5KViews0likes5CommentsPercentage Difference Shows Minus value in plus
Hi Everyone I hope you all are fine. So reference to the visuals. I have calculated a % diff between Budgeted sale 2021 and actual sale 2021. It shows the correct percentage values but in red box it should mention the percentage in minus not in positive. Kindly let me know If someone can help me out. Thanks in advance.2.2KViews0likes4Comments