Forum Discussion
Filter Matrix on Percent Change
Hi All,
Firstly parry2k thank you for your solution!
And DataFunness,For your question, you are trying to get the percentage you want based on last year's total sales, and this year's sales data from when you started until today, judging by the month selected, right?
For this question, here are some of our practical ideas we hope will help you!
ProRata_Sales_Percent_Change =
VAR SelectedMonth = SELECTEDVALUE('Table'[Month])
VAR YearFraction = SelectedMonth / 12
-- Define last year's start and end dates
VAR LastYearStartDate = DATE(YEAR(TODAY()) - 1, 1, 1)
VAR LastYearEndDate = DATE(YEAR(TODAY()) - 1, 12, 31)
-- Calculate last year's total sales
VAR LastYearTotalSales = CALCULATE(
SUM('Table'[Daily_Sales]),
ALL('Table'),
DATESBETWEEN('Table'[Date], LastYearStartDate, LastYearEndDate)
)
-- Define this year's start date and today's date
VAR CurrentYearStartDate = DATE(YEAR(TODAY()), 1, 1)
VAR CurrentDate = TODAY()
-- Calculate current year's year-to-date sales
VAR CurrentYearYTD = CALCULATE(
SUM('Table'[Daily_Sales]),
DATESBETWEEN('Table'[Date], CurrentYearStartDate, CurrentDate),
REMOVEFILTERS('Table'[Month])
)
-- Calculate the ProRata percent change
RETURN
DIVIDE(CurrentYearYTD, LastYearTotalSales * YearFraction, 0)
Possibly our example data has limitations, there is no way to reproduce your negative number of cases, but the logic is unchanged, you can replace according to your actual situation, you want to filter their own data, you can filter the filter inside the filter, I hope that this idea will be helpful to you!
Hope it helps!
Best regards,
Community Support Team_ Tom Shen
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
- DataFunness1 year agoHelper I
Anonymous, Thank you for the reply. The filter on the visiual (like you suggested) is how I had gotten the correct value (first image).
The other half of my issue is I am trying to take that value and put it into this Summary table of different financial categories. The $42 MM is the Market Share value to be displayed and should not be the $60 MM. The problem is if I put all of the filters on the visual and not included in the measure, I get the $60 MM and not the correct filtered $ 42 MM. Does that make sense? I can get the report page that shows Market Summary correct (above image), the but this summary page is its own separate page.
- Anonymous1 year agoNot applicable
Hi DataFunness ,
We try to understand what you mean, but still can't understand exactly what you need, can you show the result you want, or provide some sample pbix, so that we can better help you solve the problem!
Looking forward to your reply!